Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Colors in the Windows Command Prompt

📅 2011-Jul-28 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

 

The main color settings of the Windows command prompt that can be changed are the background and text (foreground) color. There is also the equivalent popup background and text color, but that is rarely used.

Colors Dialog

The most common way to change the colors is to open the window menu (click the top left corner of window or press Alt+Space) and choose Properties and pick the Colors tab in the Properties dialog. There are 16 pre-defined colors available for the background and text. To set a custom RGB value as the background or text color, click on one of the pre-defined color squares and then set that square's custom color by using the Selected Color Values section in the top right corner.

Color Command

Sometimes, you might be stuck at the command prompt of a friend who has set colors that are making your eyes bleed! 😁 Use the color command from the command-line to change the color for that session temporarily and save your eyes! For example to switch to a black-on-white color setting immediately, type color F0 at the prompt.

The color command accepts one value of type XY, where X and Y are hexadecimal digits. X represents the background and Y the text color. Each of those values is one of the 16 pre-defined (or customized) colors set for that command-prompt using the Colors dialog (as described above). If the same value is provided for both background and text (00 for example), it is ignored.

After finishing your work at the friend's command prompt, you can switch back to his painful colors by typing color (with no arguments).