Comment changer la couleur du texte d’avant-plan et d’arrière-plan dans la console?

J’écris un programme en console C #. Je voudrais changer le premier plan et la couleur de fond du texte dans la console.

Console.BackgroundColor//t set the background color for the text. Console.ForegroundColor//to set the foreground color for the text. Console.ResetColor();//set back the foreground color and background color to the default. 

Vous devez seulement définir

 Console.BackgroundColor = ConsoleColor.Blue; Console.ForegroundColor = ConsoleColor.Red; 

Lisez tout sur le sujet sur http://www.dotnetperls.com/console-color

 Console.ForegroundColor = ConsoleColor.Green; Console.BackgroundColor = Console.Color.White; 

Vous devriez pouvoir utiliser les propriétés suivantes (liens vers la documentation MSDN):

Console.BackgroundColor

Console.ForegroundColor