Answers for "how to change the color of the text in c#"

C#
5

how to change the color of your text in c#

using System;
class Demo {
   public static void Main (string[] args) {
      Console.BackgroundColor = ConsoleColor.Blue;
      Console.WriteLine("Background color changed = "+Console.BackgroundColor);
      Console.ForegroundColor = ConsoleColor.Yellow;
      Console.WriteLine("\nForeground color changed = "+Console.ForegroundColor);
   }
}
Posted by: Guest on February-26-2021
0

C# How to change the text colour?

// Change colour of the text

			// This code changes the next text line colour
			Console.ForegroundColor = ConsoleColor.Green;

			// Pay attention that the texts that you want to change colour on
			// Should be in between the 2 codes!
            
			// This code puts the text colour back to normal again
            Console.ResetColor();
Posted by: Guest on February-09-2022

Code answers related to "how to change the color of the text in c#"

C# Answers by Framework

Browse Popular Code Answers by Language