텍스트의 전경색을 변경하려면 C#의 Console.ForegroundColor 속성을 사용하십시오.
예
예를 들어 보겠습니다 -
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);
}
} 출력
이것은 다음과 같은 출력을 생성합니다 -
