color

set default foreground and background colors for console window 

Command


SYNOPSIS

color [-d|attr]


DESCRIPTION

The color utility sets the default foreground and background colors for the console window to those specified by the color attribute attr. Default in this case does not refer to registry persistence, but the color value used when an application does not specify any color attributes for text written. There is a persisted default color value in HKEY_CURRENT_USER\Console\ScreenColors which may be called up using the -d option and changed using the console window preferences dialog. Also, there is a per shortcut color table and default colors which can be displayed using shortcut utility. Color attributes are two digit hexadecimal numbers. The first digit indicates the background color; the second digit, the foreground color. Here are the corresponding colors for each hexadecimal digit:

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

The names used in the above table are legacy. And in fact the defaults when no palette is specified. In the console window properties dialog it is possible to adjust the actual colors specified by each of the palette indices (that used to be specific hard coded colors). Hence Light Yellow which has an RGB value of (255,255,0) can be changed to e.g. dark purple (64,0,64) in which case "E" will refer to dark purple. The current palette values can be dumped using shortcut -p, or viewed in the console window properties dialog or looking in the registry.

When you do not specify the attr argument, color restores colors to the default of white on black.

When you specify -d then the user registry default color is used in place of attr or 0x7.

If you attempt to set both the foreground and background to the same color, color considers it an error, changes neither color, and returns with an exit status of 1.


EXAMPLE

The command

color E0

sets the console window defaults to black on light yellow.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

>0 

An error occurred.


PORTABILITY

Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
cmd /c color, shortcut


PTC MKS Toolkit 10.4 Documentation Build 39.