# Colors
On many systems, NetHack can display monsters, objects and dungeon features in color, in ASCII mode. The exact appearance of these colors depends on many things, including the platform NetHack was compiled for, compile-time options, run-time options, your terminal settings and the monitor you're using. If your NetHack supports color output, it can be toggled on or off using the color option.
For the colors of the wiki itself, see function templates and ReplaceCharsBlock.

Contents

1 Monitor
2 Changing terminal colors

2.1 PuTTY
2.2 rxvt
2.3 xterm
2.4 mintty (Cygwin)
2.5 Linux console
2.6 Windows

3 Internal NetHack color codes
4 Terminal color codes
5 RGB colors

5.1 mtty palette

6 See Also

Monitor
Even the appearance of the RGB colors is not fixed, but can vary depending on your display hardware and software.  Some issues that can affect color rendering include:

Your computer may or may not apply gamma correction to colors (and, if it does, it may or may not be properly calibrated).  Also, different monitors may have different natural gamma values, and on some monitors the gamma value may even be adjustable.
CRT and LCD monitors have different color gamuts, affecting the colors they can display.
The brightness, contrast and color temperature of the monitor can also vary, and are often subject to user adjustment.
Finally, ambient lighting and variations in the human eye itself can affect the appearance of colors.
What all this comes down to is that colors which look nice and easily visible to one person may not look as good to another.  Thus, picking a good color palette is ultimately a personal, subjective choice.

Changing terminal colors
When playing without tiles, you can adjust the colors used by your terminal/console. For example, if dark blue on black background is nearly invisible, try changing the dark blue color in your console color settings.

PuTTY
The colors for PuTTY can be changed in the putty settings, or you could use Windows Console colors editor which can also create a registry file for putty. Alternatively, the putty-color-themes repository has many color themes ready.

rxvt
From the command line: rxvt -color4 lightblue.
rxvt colors can also be set via the X11 resources as seen in the xterm configuration below by using Rxvt*color4: lightblue in ~/.Xdefaults

xterm
From the command line: xterm -xrm "XTerm*color4: lightblue"
Similar to setting X11 resources, you can change the colors used by xterm, by putting eg. the following in ~/.Xdefaults:

XTerm*color4: lightblue

And then doing xrdb -merge ~/.Xdefaults to set the resource. Starting xterm after that will use the lightblue color.

mintty (Cygwin)
Changing the ANSI terminal colors in mintty doesn't seem possible using the GUI color options; you can, however, specify color preferences by editing ~/.minttyrc.  
The syntax is ColorName=R,G,B, putting each new entry on a new line.
For example:

 BoldBlue=202,169,250

Colors are referred to by their ANSI names - Black, Blue, Red, Magenta, Green, Cyan, Yellow and White; prefix these with Bold when referring to the secondary, highlighted version of the color.

Linux console
You can output an OSC control sequence to change a color. The format is: Esc]Pnrrggbb, where Esc means the escape character. nrrggbb is a sequence of 7 hexadecimal digits, where n is the color number, and rr, gg and bb are the red, green and blue parts of the color.
You can do this with the echo command, for example:

 echo -e '\e]P40000ff'

This will set the fourth color (dark blue) to the RGB values 0, 0, and 255. To reset all colors, use this sequence:

 echo -e '\e]R'

You might want to put this into a script so you don't have to do this manually every time you play.

Windows
You can edit the colors in the command prompt settings.

Internal NetHack color codes
Internally, the colors in NetHack are specified using the 16 CLR_* color codes (including NO_COLOR, a dark gray used as the default color) defined in the file includes/color.h.

color name

numeric value

CLR_BLACK

0

CLR_RED

1

CLR_GREEN

2

CLR_BROWN

3

CLR_BLUE

4

CLR_MAGENTA

5

CLR_CYAN

6

CLR_GRAY

7

NO_COLOR

8

CLR_ORANGE

9

CLR_BRIGHT_GREEN

10

CLR_YELLOW

11

CLR_BRIGHT_BLUE

12

CLR_BRIGHT_MAGENTA

13

CLR_BRIGHT_CYAN

14

CLR_WHITE

15

CLR_MAX

16

The same file also defines a number of "logical" colors for different materials and effects which map to these 16 colors: for example, both leather and wood are defined to be CLR_BROWN.

logical name

color name

HI_OBJ

CLR_MAGENTA

HI_METAL

CLR_CYAN

HI_COPPER

CLR_YELLOW

HI_SILVER

CLR_GRAY

HI_GOLD

CLR_YELLOW

HI_LEATHER

CLR_BROWN

HI_CLOTH

CLR_BROWN

HI_ORGANIC

CLR_BROWN

HI_WOOD

CLR_BROWN

HI_PAPER

CLR_WHITE

HI_GLASS

CLR_BRIGHT_CYAN

HI_MINERAL

CLR_GRAY

DRAGON_SILVER

CLR_BRIGHT_CYAN

HI_ZAP

CLR_BRIGHT_BLUE

Terminal color codes
On systems where NetHack outputs text to be displayed in a terminal (rather than handling text rendering by itself), the internal color codes defined in color.h are mapped to ANSI escape codes or equivalent codes defined in the system terminfo.  This mapping is specified in win/tty/termcap.c, and (for a mapping of 16 to 16 colors) is surprisingly platform-dependent.  Notable quirks include:

On systems defining MICRO (which are these?), CLR_BLUE is mapped to the same color code as CLR_BRIGHT_BLUE, presumably because the default blue is considered too dark.
On many (most?) systems (which?), no color codes are defined for CLR_BLACK, CLR_GRAY and NO_COLOR, leaving them all as the default text color (usually gray).
On Unix systems using terminfo, CLR_BLACK is actually aliased to CLR_BLUE.  There is a comment saying that this is done to avoid trying to display black text on a (presumed) black background, as it might not be visible.
On the Atari TOS port, several of the darker colors are mapped to their bright counterparts.  (Which ones? The code is kind of confusing...)
On some systems, the mapping from NetHack colors to terminal colors may be adjusted using the videocolors option.

RGB colors
On some systems, NetHack directly maps the 16 internal color codes to RGB colors.  On others, this task is left for the terminal emulator, while on some (mainly older) systems, the color choices may even be determined by the graphics hardware.

A user has suggested improving this page or section as follows:
"List some NetHack/terminal color palettes here."

mtty palette
Black
Red
Green
Brown
Blue
Magenta
Cyan
Gray
Orange
Bright green
Yellow
Bright blue
Bright magenta
Bright cyan
White
See Also
Template:Monsters
Options#color
Options#MONSTERCOLOR

This page may need to be updated for the current version of NetHack.
It may contain text specific to NetHack 3.4.3. Information on this page may be out of date.
Editors: After reviewing this page and making necessary edits, please change the {{nethack-343}} tag to the current version's tag or {{noversion}} as appropriate.