CMD Simulator
System Informationcolor

COLOR Command – Change Console Foreground and Background Colors in Windows

Learn how to use the COLOR command to customize Command Prompt colors in Windows CMD. Set foreground and background with hex codes for better readability and script branding.

Rojan Acharya··Updated Mar 17, 2026
Share

The COLOR command is a Windows Command Prompt utility that sets the console's foreground and background colors using a two-character hex code. Use COLOR to customize your Command Prompt appearance for better readability, script branding, or visual distinction between different sessions—essential for power users and batch script developers.

Whether you're customizing your development environment for reduced eye strain, creating batch scripts with distinct visual feedback, or distinguishing between multiple CMD windows, the COLOR command provides quick, scriptable console customization. IT professionals use COLOR for session identification and script output styling.

This comprehensive guide covers COLOR syntax, the hex color code system, practical examples for common color combinations, troubleshooting tips, related commands, and frequently asked questions. By the end, you'll confidently customize Command Prompt colors from the command line and in batch scripts.

What Is the COLOR Command?

The COLOR command is a Windows Command Prompt utility that changes the default foreground (text) and background colors of the console window. You specify colors using a two-character hex code: the first character is the background, the second is the foreground. Each character can be 0-9 or A-F, representing 16 possible colors.

COLOR works in Command Prompt (CMD), Windows Terminal (CMD profile), and is available in all Windows versions from Windows XP through Windows 11. The color change applies to the current session and persists until you change it again or close the window.

Color Code Reference

CodeColor
0Black
1Blue
2Green
3Aqua
4Red
5Purple
6Yellow
7White
8Gray
9Light Blue
ALight Green
BLight Aqua
CLight Red
DLight Purple
ELight Yellow
FBright White

Syntax

COLOR [attr]

Parameters

ParameterDescription
attrTwo hex digits: first = background, second = foreground. Optional: single digit sets foreground only (background defaults to black).
(none)Display current color setting

Examples: COLOR 0A = black background, green text. COLOR 1F = blue background, white text.

How to Use COLOR Command

Set Custom Colors

COLOR 0A

Black background (0), green text (A). Classic terminal look.

High Contrast

COLOR F0

White text (F) on black background (0). Good for readability.

Blue Background, White Text

COLOR 1F

Common for "administrator" or elevated session styling.

Reset to Default

COLOR

Running COLOR without arguments displays the current setting. To reset to default (black background, light gray text), use COLOR 07 or COLOR 0F.

In Batch Scripts

@echo off
COLOR 0A
echo Script running with green text...
pause
COLOR 07

Use COLOR at script start to indicate script type or status.

Common Use Cases

  1. Reduce eye strain – Use dark background (0) with light text (7, F, A, B)
  2. Script branding – Set distinct colors for different batch scripts
  3. Session identification – Use different colors for admin vs. user CMD windows
  4. Error/warning indication – Change color before error messages, restore after

Tips and Best Practices

  • Use COLOR 0A or COLOR 0B for a classic terminal aesthetic
  • Avoid COLOR 00 (black on black)—text becomes invisible
  • In scripts, restore the original color before exiting if you changed it
  • COLOR affects the entire console; it cannot color individual lines (use ANSI in Windows 10+ for that)

Troubleshooting Common Issues

"Invalid color"

Ensure you use valid hex digits (0-9, A-F). The attribute must be one or two characters.

Colors not changing

Some terminals (e.g., Windows Terminal with certain profiles) may override COLOR. Check terminal settings.

Invisible text

If background and foreground are the same (e.g., COLOR 00), text becomes invisible. Use COLOR 07 to restore.

Related Commands

TITLE – Set Window Title

TITLE sets the console window title. Use with COLOR for full window customization.

CLS – Clear Screen

CLS clears the console. Useful after changing colors to see the new scheme on a clean screen.

PROMPT – Customize Prompt

PROMPT changes the command prompt string. Combine with COLOR for a fully customized CMD experience.

Frequently Asked Questions

What does the COLOR command do?

COLOR sets the console's foreground and background colors using a two-character hex code (e.g., 0A = black background, green text).

What are the COLOR command codes?

0-9 and A-F represent 16 colors. 0=Black, 1=Blue, 2=Green, 3=Aqua, 4=Red, 5=Purple, 6=Yellow, 7=White, 8=Gray, 9-A=Light Blue through F=Bright White.

How do I reset colors to default?

Use COLOR 07 (black background, light gray text) or COLOR 0F (black background, white text).

Can I use COLOR in batch files?

Yes. COLOR is commonly used at the start of batch scripts to set a distinct appearance.

Why is my text invisible after COLOR?

You may have set foreground and background to the same color (e.g., COLOR 00). Use COLOR 07 to fix.

Quick Reference Card

CommandPurposeExample
COLOR 0ABlack bg, green textClassic terminal
COLOR 1FBlue bg, white textAdmin style
COLOR F0White on blackHigh contrast
COLOR 07Default (gray on black)Reset

Try the COLOR Command in Our Simulator

Practice the COLOR command in our Windows Command Simulator. See how different color codes affect the console appearance.

Visit the Commands Reference for a full list of supported Windows CMD commands.

Summary

The COLOR command sets the Command Prompt's foreground and background colors using a two-character hex code. Use it for customization, script branding, and session identification. Always use valid hex digits (0-9, A-F) and avoid matching foreground and background to prevent invisible text.