I'm building a calendar and I want to set the important meetings red, the others white. How can I achieve that? When I set the color for the last row red the not important meetings are also red. My code:
string important;
Console.Write("High priority? input yes or no: ");
important = Console.ReadLine();
if (important == "yes" || important == "Yes")
{
important = "Important";
}
else
{
important = "Normal";
}
Console.Write("Priority: " + important);
If you change ForeGroundColor
to Red
, you have to reset it to Gray
which is the default color. You can use this code
Console.Write("High priority? input yes or no: ");
string important = Console.ReadLine();
if (important.Equals("yes", StringComparison.InvariantCultureIgnoreCase))
{
Console.Write("Priority: ");
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("Important");
}
else
{
Console.ForegroundColor = ConsoleColor.White;
Console.Write("Priority: Normal");
}
Console.ResetColor(); //default