Last Updated :
24 Jun, 2024
Customizing the appearance of your Command Prompt can make your coding or command execution sessions more enjoyable and easier on the eyes. In this guide, we’ll walk you through the process of changing colours in Command Prompt, from altering text colour to adjusting the background for better clarity and personal preference. Whether you want to modify the entire colour scheme or just tweak a few settings, these steps will help you personalize your Command Prompt environment effectively. Get ready to transform the standard black-and-white backdrop into a more vibrant and user-friendly interface.
First, it’s important to know for reference how a default Command Prompt terminal looks like, it looks something like this:
Here, we are going to change the color text and also the background color of cmd. Assume 2 variable x & y which are associated with specific colors.
color xy
‘x‘ represents the color of the Terminal’s background, whereas,
‘y‘ represents the color of the font on the Command Prompt Terminal.
Following the HEX values of the colors supported by Command Prompt:
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White
Example 1:
Suppose we want a white background, so after referring to the color table above we will type, ‘f’ in place of ‘x’. Similarly, if we want a light purple colored font, we will type ‘d’ in place of ‘y’. (x & y are the variables we had assumed earlier).
color fd
Example 2:
‘0’ specifies the black color attribute, and since its typed at the place of ‘x’ i.e. it will be applied to background. ‘a’ specifies the light green color attribute, and since its typed at the place of ‘y’ i.e light green attribute will be applied to the font color.
color 0a
Note: To get all the related information on using color command in Command Prompt you can use the following command
color /?
In conclusion, customizing the colors in Command Prompt not only enhances the visual appeal but can also improve usability by making the text easier to read. By adjusting the color settings, you can create a Command Prompt environment that aligns with your preferences and working style. Whether you’re setting a different background color or changing the text color for better contrast, these simple modifications can significantly enrich your experience with Windows Command Prompt.
Download Article
Download Article
Are you bored of the plain white text on black background in cmd? If yes then read on to know how to change the text colour and the background colour.
-
-
Advertisement
-
The first letter/number in the command is the colour of the background and the second is the colour of the text.
-
Use the letter/number for the color you want. e.g. Type ‘color 6’ to have yellow text, ‘color 4’ to have red text, ‘color A’ to have light green text etc. ( Ignore all quotes )
-
To change the colour of the text as well as the background, type ‘color ce’ ( without the quotes ) to have light yellow text on a light red background or any other combination.
Advertisement
-
-
-
-
-
- Play around with the combinations!
-
Advertisement
Add New Question
-
Question
Can I color certain letters or words?
Yes. Right click on the tab or image, then go to properties, then go to color and you can change the background color and the letters.
-
Question
How do I do this in a specific batch file?
Flashlight
Community Answer
Simply type the same command line code you used into the batch before echoing.
-
Question
How do I change my command prompt color to a rainbow color?
CaTsArEsOcUtE
Community Answer
I do not think there is a way to change it to rainbow color.
See more answers
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
Video
List of Possible Colors
- 0 = Black
- 1 = Blue
- 2 = Green
- 3 = Aqua
- 4 = Red
- 5 = Purple
- 6 = Yellow
- 7 = White
- 8 = Gray
- 9 = Light Blue
- A = Light Green
- B = Light Aqua
- C = Light Red
- D = Light Purple
- E = Light Yellow
- F = Bright White
-
Be careful of the spellings of ‘color’ and do not type ‘colour’. Otherwise it will not work.
Thanks for submitting a tip for review!
Advertisement
About This Article
Thanks to all authors for creating a page that has been read 436,799 times.
Is this article up to date?
Overview
The COLOR
command in Windows Command Prompt (CMD) is used to set the default foreground (text) and background colors of the console window. This command can enhance readability or personalize the look of the command-line interface. It is often used in scripts to denote different process stages or alert statuses visually.
Syntax
To use the COLOR
command, the syntax is:
COLOR [attribute]
The attribute
is a two-digit hexadecimal code where the first digit represents the background color and the second digit represents the text color.
If no attribute
is provided, the command resets the color to what was set when CMD was opened.
Options/Flags
The COLOR
command supports hexadecimal characters, each representing a different color:
0
Black1
Blue2
Green3
Aqua4
Red5
Purple6
Yellow7
White8
Gray9
Light BlueA
Light GreenB
Light AquaC
Light RedD
Light PurpleE
Light YellowF
Bright White
Leading zero is necessary if the color attribute should change only one color (foreground or background).
Default:
If the COLOR
command is run without arguments, it will revert to the default colors of the CMD window.
Examples
- Set text color to Light Red with Black background
COLOR 4C
- Reset to default color settings
COLOR
- Set background to Green and text color to Light Aqua
COLOR 2B
Common Issues
- Invalid color codes: Users must ensure the syntax contains only two valid hexadecimal characters. If invalid codes are used, CMD will ignore the command.
- Visibility issues: Some color combinations (e.g., blue text on a blue background) can lead to unreadable text. Always choose contrasting colors.
Integration
Script Usage
In batch files, COLOR
can be used to signal different sections of the script or signify success/warning/error states:
@echo off
COLOR 2E
echo Starting processing...
REM Processing steps here
COLOR 4E
echo WARNING: Low memory detected.
REM More processing steps here
COLOR A2
echo Process completed successfully.
Combined with ECHO
Used with ECHO
, COLOR
can highlight specific messages:
COLOR C
echo IMPORTANT: System will restart in 5 minutes!
MODE
: Adjusts properties of the console, including display settings.TITLE
: Sets the Command Prompt window title which can be visually informative along with color coding.
For more commands related to CMD customization, see Microsoft’s official CMD documentation.
This guide covers how to use the COLOR
command to customize the appearance of your CMD session dynamically and visually communicates the condition or status within scripts or during routine CMD interactions.
- SS64
- CMD
- How-to
Sets the default console foreground and background colours.
Syntax COLOR [background][foreground]
Colour attributes are specified by 2 of the following hex digits. There should be no space between the two color numbers.
Each digit can be
any of the following values:
0 = Black 1 = Blue 2 = Green 3 = Aqua 4 = Red 5 = Purple 6 = Yellow 7 = White 8 = Gray 9 = Light Blue A = Light Green B = Light Aqua C = Light Red D = Light Purple E = Light Yellow F = Bright White
The default terminal color is COLOR 07 – Black background (0) + white foreground (7).
If no argument is given, COLOR restores the colour to what it was when CMD.EXE started.
New default Colour schemes
In Windows 10 clean-install versions greater than build 16257 the default colour scheme has been changed to modernize the look of the Windows Console suitable for modern high-contrast LCD displays.
Samples of the new colors can be found on the ANSI color page, you can also display them with ColorTool.exe -c
If using ColorTool, you may want to tinker with the new values: «So up until very recently the console only supported 16 colours at a time. When the PowerShell team decided they wanted a very specific dark blue as the background colour, rather than altering the colour value for dark or light blue, they instead changed dark magenta to blue and used that as the background colour».
24 bit colors
The new W10 Console also adds full 24-bit colour support, this is primarily for Linux compatibility so the console properties page and the default Windows colour mappings still use just 16 colours, there is no plan to add additional console colours to the Win32 API.
To take advantage of the new colours use ColorTool.exe and install a theme, or use the VT100 sequences described here.
When the VT100 sequences are used with a version of the Windows Console that supports 24-bit colours they will display the desired RGB colour, older consoles will choose the nearest appropriate colour from the existing 16 colour table.
Colour values are assigned in the following order:
- The DefaultColor registry value.
- The CMD /T command line switch
- The current colour settings when cmd was launched.
The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute the COLOR command with a foreground and background colour that are the same.
The COLOR command will change the colour of all the text in the window. To change the colour of individual words/characters/paragraphs ANSI color escapes can be used. These are available in Windows versions greater than 1511.
Errorlevels
If the colour was successfully changed %ERRORLEVEL% = 0
Background and foreground colours are the same (will fail) = 1
e.g. COLOR 00
COLOR is an internal command.
If Command Extensions are disabled, the COLOR command will not function.
Examples
Set the colour to White on Blue:
color 17
“How much more black could this be?» and the answer is «None…none more black” ~ Spinal Tap
Related commands
CMD — Start a new CMD shell.
EXIT — Set a specific errorlevel.
How-to: Use ANSI colours in the terminal.
PowerShell: Write-Host — Write output to the screen (colour can be set for individual strings).
Colour codes — HTML/CSS.
Aaron Margosis — Change prompt colours for all Admin level prompts.
Paletton — Design colour themes.
Equivalent bash command (Linux): dircolors — Colour setup for ‘ls’
Copyright © 1999-2025 SS64.com
Some rights reserved
-
Batch Script or File
-
Change the Text Color of CMD Using Batch Script
-
Change the Text Color of CMD Every 1 Second
This article will first discuss the basic concept of a Batch script or Batch file. After introducing the Batch script, we will discuss the method for changing the text color of CMD every second using the Batch script.
Batch Script or File
A Batch script is a file containing different commands executed in a sequence. A Batch file or script stores different commands executed using the command line interpreter.
For example, the following is a Batch file hello.bat
:
@ECHO OFF
ECHO Hello World
The above Batch script contains two lines.
The first command, @ECHO OFF
, is used to hide all the commands, which are executed, from displaying on the command prompt itself. The ECHO Hello World
command displays Hello World
.
The output of the above batch script is as follows:
We can execute the .bat
file on the command line by typing the file name followed by the Enter key, as shown in the above figure. We can also run the batch file by double-clicking the file.
Batch File Extensions
A Batch script can be written in any typing or text editor with different file extensions, including .bat
, .cmd
, and .btm
.
- The
.bat
file extension is used for Batch scripts in DOS or Windows operating systems. - The
.cmd
file extension is used for Windows NT or OS/2. - The
btm
file extension is used in 4DOS or 4NT.
Change the Text Color of CMD Using Batch Script
In the Batch script, we can use a different color for text on cmd. The color
command can be used to change the text color.
For example, color [number]
is a color
command followed by the color number in hexadecimal. This hexadecimal number is like an alias to a specific color.
Consider the following script:
@echo off
color 06
echo Hello World
Output:
The above script contains a color 06
command, the hexadecimal number used as a code for the yellow color. Therefore, the said color command changes the text color of the command-line interface to yellow.
Following is the list of different available colors with their codes:
Change the Text Color of CMD Every 1 Second
We can use the color
and timeout
commands to change the text color of the cmd every unit of time. Consider the following script:
@echo off
set colors=0 1 2 3 4 5 6 7 8 9 A B C D E F
for %%n in (%colors%) do (
echo Hello World
color %%n
timeout 1 > null
)
The above script contains an array named colors
initialized with a sequence of codes for different colors, followed by a for
loop which iterates on the colors array and selects a color code in a variable n
. In the body of the for
loop, the script displays the Hello World
on screen and sleeps for 1 second using the timeout
command.
The color
command changes the text color in each iteration of the loop with different colors available in the colors
array.
The above script will change the text color of the output after each for
iteration. The outputs for some iterations of the loop are as follows:
Enjoying our tutorials? Subscribe to DelftStack on YouTube to support us in creating more high-quality video guides. Subscribe