In C#, Console.ResetColor sets the console’s foreground and background colors back to the system defaults for the session.
You typically change Console.ForegroundColor or BackgroundColor for emphasis, then call ResetColor so later text is not stuck in the highlight color.
This is a static member of System.Console. You call it with the type name, such as Console.ResetColor(...). Console is the everyday API for reading from standard input and writing to standard output in C# console apps.
Restores default foreground and background colors.
Color support depends on the terminal. ResetColor returns you to the defaults the runtime tracks.
Library declarations
C#
public static void ResetColor();
Parameters
Parameter
Description
None
ResetColor() takes no parameters.
Return Value
Return Value
Description
void
Colors are restored; nothing is returned.
C# Examples
Example 1 — Yellow Warning Then Reset
Highlight a warning, then return to default colors.
C#
using System;
class Program {
static void Main() {
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Warning: disk almost full");
Console.ResetColor();
Console.WriteLine("Back to normal text");
}
}
Output
Warning: disk almost full
Back to normal text
How It Works
Set yellow. ForegroundColor changes upcoming text color.
Warning line. Printed while yellow is active.
ResetColor. Defaults return for the next line.
Normal text. Final line uses the restored colors.
Example 2 — Red Error Message
Use red for errors, then reset.
C#
using System;
class Program {
static void Main() {
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Error: file not found");
Console.ResetColor();
Console.WriteLine("Please try again");
}
}
Output
Error: file not found
Please try again
How It Works
Red foreground. Signals an error visually.
Reset after. Prevents the whole session staying red.
Follow-up help. Guidance prints in default color.
sample output. Shows text; your terminal shows the colors.
Example 3 — Color a Header Only
Color a title, reset, then print a body.
C#
using System;
class Program {
static void Main() {
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("=== Report ===");
Console.ResetColor();
Console.WriteLine("Items: 3");
Console.WriteLine("Status: OK");
}
}
Output
=== Report ===
Items: 3
Status: OK
How It Works
Cyan header. Only the title uses the accent color.
Immediate reset. Body lines stay default.
Readable structure. Color marks the section without flooding it.
Two body lines. Printed after ResetColor.
Frequently Asked Questions
The default foreground and background colors for the console session.
Call it after temporary color changes so later text is not stuck colored.
Console.ForegroundColor and Console.BackgroundColor.
Support depends on the terminal or host.
No. ResetColor fixes colors; Clear erases the screen.