A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/c-sharp/console-resetcolor-method-in-c-sharp/ below:

Console.ResetColor() Method in C# - GeeksforGeeks

Console.ResetColor() Method in C#

Last Updated : 11 Jul, 2025

Console.ResetColor() Method is used to the foreground and background console colors to their defaults i.e. background to black and foreground to white.
Syntax: 
 

public static void ResetColor ();


Exceptions: 
 


Below programs illustrate the use of the above-discussed method:
Example 1: Setting the console colors to red and yellow
 

csharp
// C# program to set the colors to red and yellow
// to demonstrate ResetColor() in next example
using System;

namespace GFG {

class Program {

    // Main Method
    static void Main(string[] args)
    {
        // using BackgroundColor property
        Console.BackgroundColor = ConsoleColor.Yellow;

        // using ForegroundColor property
        Console.ForegroundColor = ConsoleColor.Red;

        Console.WriteLine("Welcome to GeeksForGeeks");
    }
}
}

Output:
 


Example 2: Resetting the colors to default
 

csharp
// C# program to illustrate the
// Console.ResetColor Property
using System;
namespace GFG {

class Program {

    // Main Method
    static void Main(string[] args)
    {

        // using ResetColor() Method
        Console.ResetColor();

        Console.WriteLine("Welcome to GeeksForGeeks");
    }
}
}

Output:
 


Reference: 
 



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4