I'm currently struggling with trying to generate a random color for an element in a cshtml view. No matter what I attempt, it just won't cooperate. When I include the @ symbol, the color property doesn't highlight as expected, leading me to believe it's not going to work.
@using(//using code for accessing database)
{
//code to make query
Random rnd = new Random();
Color randomColor = Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256));
//other code
//displaying information
<p style="color: @randomColor">@db.item</p>
}