टेक्स्ट का फ़ोरग्राउंड कलर बदलने के लिए, 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);
}
} आउटपुट
यह निम्नलिखित आउटपुट देगा -
