Color cmd command

Configurare noua (How To)

Situatie

Color is an inbuilt command found inside the Windows Command Processor (cmd.exe), that is used for changing the colors of the console’s foreground and background. By default, the console has white foreground color and black background color (07 color code). The command is generally used either to personalize the aesthetics of the console window, or the make the colors more appropriate for Dim or Dark Displays (ex. TN panels).

Solutie

Pasi de urmat

Description of the Command: Type the command – color /? in the Command Prompt. It sets the default console foreground and background colors.

COLOR [attr]
attr - Specifies the color attribute of console output.

Color attributes are specified by two hex digits –

  • First corresponds to the background.
  • Second corresponds to the foreground.

Using the Command: The command takes in input 2 hexadecimal digits (2nd digit optional) where the first digit corresponds to the background color and the second digit corresponds to the foreground color.

Syntax:

Color (Background)(Foreground)

If the first digit is only provided, then only the foreground color changes. Each digit can have any of the values in hexadecimal codepoint (0 – f) where each one corresponds to a unique color. The digit-to-color correspondence is as follows –

  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

Syntax:

Color 1F

It will produce bright White on Dark Blue. Any combination of the above set of digits could be used, except for the special case in which the foreground and the background color is the same (Ex. color FF or color 33). In that case, no color change occurs, and the value of %ERRORLEVEL% changes to 1. If the command is executed without providing any parameters, then the command will restore the color to which cmd.exe initially started as.

Changing Only The Foreground Color:

Syntax:

Color (Hex_digit)
  1. (Hex_digit) is a digit (or character) within the hexadecimal range, i.e. it should belong in the range 0-F. Example : We will change the foreground color to Yellow (6). Before:

Tip solutie

Permanent

Voteaza

(0 din 0 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?