COLOR: Sets the default console foreground and background colors.


 


... The examples for the command "COLOR"
... "COLOR" Excerpt from Microsoft Windows Help
... Important information, tips for the "COLOR" command

The command: "COLOR" is on Windows 12, 11, 10, .. , MS Server 2025, 2022, 2019, .. available

The examples for the command "COLOR"

The `COLOR` command in Windows Command Prompt is used to change the color of the text and background in the console. Here are some examples with comments: Example 1: Reset color to default:

COLOR

Description: This command resets the colors to their default values, usually Black Text on a White Background. Example 2: Change text color:

COLOR 0A

Description: Here the text color is set to light green (`A`) and the background is set to black (`0`). Example 3: Change background color:

COLOR 4E

Description: This command changes the background color to dark red (`4`) and the text color to yellow (`E`). Example 4: Combining colors:

COLOR 1F

Description: Here the text color is set to blue (`1`) and the background color is set to light white (`F`). Example 5: Using color code in a batch script:

@ECHO OFF
REM Change the colors
COLOR 3B
ECHO This text is now in light yellow on dark blue.

Description: This batch script changes the colors from light yellow to dark blue and then prints a corresponding message. Example 6: Changing colors using the ECHO statement:

ECHO [1;31mThis text is in light red. [0m

Description: This example uses ANSI color code (used here as an escape sequence with `ECHO`) to change the text color to light red. Note: Color changes with `COLOR` are limited to the current command prompt session and are not saved permanently. If you want to use `COLOR` in a batch script or command line interaction, I recommend using the color numbers and letters to improve readability. Use `COLOR /?` for a list of available color codes.

"COLOR" Excerpt from Microsoft Windows Help

Microsoft Windows [Version 10.0.19045.3693]
(c) Copyright 1985-2023 Microsoft Corp.

C:\\WINDOWS>

Sets the default console foreground and background colors.

COLOR [attr]

  attr        Specifies color attribute of console output

Color attributes are specified by TWO hex digits -- the first
corresponds to the background; the second the foreground.  Each digit
can be any of the following values:

    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

If no argument is given, this command restores the color to what it was
when CMD.EXE started.  This value either comes from the current console
window, the /T command line switch or from the DefaultColor registry
value.

The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute
the COLOR command with a foreground and background color that are the
same.

Example: "COLOR fc" produces light red on bright white

Important information, tips for the "COLOR" command

There are a few points to note when using the `COLOR` command in the Windows Command Prompt: 1. Limited Color Palette: Windows Command Prompt only supports a limited color palette. Color changes are limited to the available colors and background combinations. 2. Color Code Format: The color code consists of two parts - the first part for the background and the second part for the text. Each part can be a number from 0 to 15 or a letter from 0 to F. Note that the interpretation of letters and numbers can vary. 3. Inappropriate Color Combinations: Some color combinations may result in hard-to-read or unreadable text. Choose colors carefully to ensure readability. 4. Not Permanent: The changes made using `COLOR` are not permanent. If you close and reopen the CMD window, the default colors will be restored. 5. No RGB colors: `COLOR` does not support RGB colors. The color palette is based on predefined colors and is limited. 6. Affects consistency: Changes made by `COLOR` affect the entire prompt session and can affect UI consistency, especially when colors are used in scripts. 7. ANSI Color Code: You can also use ANSI color code sequences to represent colors in the prompt. This method can be more flexible, but does not support all terminals. 8. Support in PowerShell: Note that in PowerShell the `COLOR` command is not normally available. Instead, PowerShell uses other methods like `Write-Host` with color parameters.

Write-Host "This text is in yellow on blue" -ForegroundColor Yellow -BackgroundColor Blue

9. Batch scripts: When using `COLOR` in batch scripts, keep in mind that this applies to the entire session and may be affected by other scripts. 10. Compatibility: Note that the use of colors in the Command Prompt may not be the same on all systems or terminal emulators. It may not be available on older or non-Windows systems. 11. Consider readability: Make sure that the color combinations you choose improve readability and do not affect the user experience. Using colors in the Command Prompt is a useful way to improve visibility and structure. However, be sure to use them carefully to maintain consistency and readability.


Deutsch
English
Español
Français
Italiano
日本語 (Nihongo)
한국어 (Hangugeo)
汉语 (Hànyǔ)
Türkçe
Português
Português
Svenska
Norsk
Dansk
Suomi
Nederlands
Polski









Windows-10


... Windows 10 FAQ
... Windows 10 How To


Windows 10 How To


... Windows 11 How To
... Windows 10 FAQ



The command COLOR - Sets the default console foreground and background colors.

HTTP: ... console/en/014.htm
0.078
16744
Windows 10/11: Activate developer mode excluding any ifs and buts!
After upgrade, user switching does not show why Windows 10 / 11?
Download free Windows 10/11 Terminal!
Wie schnell startet das Betriebssystem Windows 10?
The credential management on Windows 10/11!
Warum wird die Schriftart nicht korrekt gedruckt?
Convert the FAT32 to NTFS excluding losing data under Windows-10, -11 abd -12?
Die Virtualisierung ist auf einmal weg unter Windows 10 / Server 2016!
The regional settings in Microsoft Windows 10/11!
Deaktivieren Sie dünne Scrollleisten unter Windows 10!



(0)