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.
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, most 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 — however, terminals may support, and the game can then use, more than the 16 basic colors. Finally, on some (mainly older) systems, the color choices may even be determined by the graphics hardware.
Since version 5.0.0, the game uses extended colors for walls in gnomish mines and Fort Ludios with Enhanced1 and Enhanced2 symsets. Any customizations made using OPTIONS=glyph statements in the configuration file can use extended colors, as well.
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
256 colors
Curses interface, popular for its ability to better utilize big screens, does not support RGB colors. However, in recent development version of NetHack 5.0.x (to be 5.0.1, currently playable on Hardfought server) this interface is able to use 256 colors on terminals that have a 256-color palette. Any RGB colors, such as those configured using OPTIONS=glyph, will be displayed as follows:
- the RGB color is mapped[1] to the nearest (for some definition of color distance[2]) extended color (i.e. color 16 to 255) from what NetHack expects this 256-color palette to be[3];
- the terminal is asked to display a color from its 256-color palette with the index resulting from this mapping;
- many terminals have the exact 256-color palette the game expects, resulting in colors rendering as intended.
The same mapping is performed when using TTY interface and the terminal supports 256 colors but not RGB colors.
The 240 extended colors from this palette, with their RGB codes, are the following:
| 000000 | 00005f | 000087 | 0000af | 0000d7 | 0000ff | 005f00 | 005f5f |
| 005f87 | 005faf | 005fd7 | 005fff | 008700 | 00875f | 008787 | 0087af |
| 0087d7 | 0087ff | 00af00 | 00af5f | 00af87 | 00afaf | 00afd7 | 00afff |
| 00d700 | 00d75f | 00d787 | 00d7af | 00d7d7 | 00d7ff | 00ff00 | 00ff5f |
| 00ff87 | 00ffaf | 00ffd7 | 00ffff | 5f0000 | 5f005f | 5f0087 | 5f00af |
| 5f00d7 | 5f00ff | 5f5f00 | 5f5f5f | 5f5f87 | 5f5faf | 5f5fd7 | 5f5fff |
| 5f8700 | 5f875f | 5f8787 | 5f87af | 5f87d7 | 5f87ff | 5faf00 | 5faf5f |
| 5faf87 | 5fafaf | 5fafd7 | 5fafff | 5fd700 | 5fd75f | 5fd787 | 5fd7af |
| 5fd7d7 | 5fd7ff | 5fff00 | 5fff5f | 5fff87 | 5fffaf | 5fffd7 | 5fffff |
| 870000 | 87005f | 870087 | 8700af | 8700d7 | 8700ff | 875f00 | 875f5f |
| 875f87 | 875faf | 875fd7 | 875fff | 878700 | 87875f | 878787 | 8787af |
| 8787d7 | 8787ff | 87af00 | 87af5f | 87af87 | 87afaf | 87afd7 | 87afff |
| 87d700 | 87d75f | 87d787 | 87d7af | 87d7d7 | 87d7ff | 87ff00 | 87ff5f |
| 87ff87 | 87ffaf | 87ffd7 | 87ffff | af0000 | af005f | af0087 | af00af |
| af00d7 | af00ff | af5f00 | af5f5f | af5f87 | af5faf | af5fd7 | af5fff |
| af8700 | af875f | af8787 | af87af | af87d7 | af87ff | afaf00 | afaf5f |
| afaf87 | afafaf | afafd7 | afafff | afd700 | afd75f | afd787 | afd7af |
| afd7d7 | afd7ff | afff00 | afff5f | afff87 | afffaf | afffd7 | afffff |
| d70000 | d7005f | d70087 | d700af | d700d7 | d700ff | d75f00 | d75f5f |
| d75f87 | d75faf | d75fd7 | d75fff | d78700 | d7875f | d78787 | d787af |
| d787d7 | d787ff | d7af00 | d7af5f | d7af87 | d7afaf | d7afd7 | d7afff |
| d7d700 | d7d75f | d7d787 | d7d7af | d7d7d7 | d7d7ff | d7ff00 | d7ff5f |
| d7ff87 | d7ffaf | d7ffd7 | d7ffff | ff0000 | ff005f | ff0087 | ff00af |
| ff00d7 | ff00ff | ff5f00 | ff5f5f | ff5f87 | ff5faf | ff5fd7 | ff5fff |
| ff8700 | ff875f | ff8787 | ff87af | ff87d7 | ff87ff | ffaf00 | ffaf5f |
| ffaf87 | ffafaf | ffafd7 | ffafff | ffd700 | ffd75f | ffd787 | ffd7af |
| ffd7d7 | ffd7ff | ffff00 | ffff5f | ffff87 | ffffaf | ffffd7 | ffffff |
| 080808 | 121212 | 1c1c1c | 262626 | 303030 | 3a3a3a | 444444 | 4e4e4e |
| 585858 | 626262 | 6c6c6c | 767676 | 808080 | 8a8a8a | 949494 | 9e9e9e |
| a8a8a8 | b2b2b2 | bcbcbc | c6c6c6 | d0d0d0 | dadada | e4e4e4 | eeeeee |
Extended color names
In context where color is given as a string, such as OPTIONS=glyph entries in the configuration file, in addition to basic color names such as "red", "blue", etc. and RGB codes, the game recognizes following color names[4]. Their values are not from the 256-color palette, so these colors are rendered slightly differently depending on whether RGB colors or 256 colors are used.
| maroon | dark-red | firebrick | crimson | tomato |
| coral | indian-red | light-coral | dark-salmon | salmon |
| light-salmon | orange-red | dark-orange | gold | dark-golden-rod |
| golden-rod | pale-golden-rod | dark-khaki | khaki | olive |
| yellow-green | dark-olive-green | olive-drab | lawn-green | chart-reuse |
| green-yellow | dark-green | forest-green | lime | lime-green |
| light-green | pale-green | dark-sea-green | medium-spring-green | spring-green |
| sea-green | medium-aqua-marine | medium-sea-green | light-sea-green | dark-slate-gray |
| teal | dark-cyan | aqua | dark-turquoise | turquoise |
| medium-turquoise | pale-turquoise | aqua-marine | powder-blue | cadet-blue |
| steel-blue | corn-flower-blue | deep-sky-blue | dodger-blue | light-blue |
| sky-blue | light-sky-blue | midnight-blue | navy | dark-blue |
| medium-blue | royal-blue | blue-violet | indigo | dark-slate-blue |
| slate-blue | medium-slate-blue | medium-purple | dark-magenta | dark-violet |
| dark-orchid | medium-orchid | purple | thistle | plum |
| violet | orchid | medium-violet-red | pale-violet-red | deep-pink |
| hot-pink | light-pink | pink | antique-white | beige |
| bisque | blanched-almond | wheat | corn-silk | lemon-chiffon |
| light-golden-rod-yellow | light-yellow | saddle-brown | sienna | chocolate |
| peru | sandy-brown | burly-wood | tan | rosy-brown |
| moccasin | navajo-white | peach-puff | misty-rose | lavender-blush |
| linen | old-lace | papaya-whip | sea-shell | mint-cream |
| slate-gray | light-slate-gray | light-steel-blue | lavender | floral-white |
| alice-blue | ghost-white | honeydew | ivory | azure |
| snow | dim-gray | dark-gray | silver | light-gray |
| gainsboro | white-smoke |
| maroon | dark-red | firebrick | crimson | tomato |
| coral | indian-red | light-coral | dark-salmon | salmon |
| light-salmon | orange-red | dark-orange | gold | dark-golden-rod |
| golden-rod | pale-golden-rod | dark-khaki | khaki | olive |
| yellow-green | dark-olive-green | olive-drab | lawn-green | chart-reuse |
| green-yellow | dark-green | forest-green | lime | lime-green |
| light-green | pale-green | dark-sea-green | medium-spring-green | spring-green |
| sea-green | medium-aqua-marine | medium-sea-green | light-sea-green | dark-slate-gray |
| teal | dark-cyan | aqua | dark-turquoise | turquoise |
| medium-turquoise | pale-turquoise | aqua-marine | powder-blue | cadet-blue |
| steel-blue | corn-flower-blue | deep-sky-blue | dodger-blue | light-blue |
| sky-blue | light-sky-blue | midnight-blue | navy | dark-blue |
| medium-blue | royal-blue | blue-violet | indigo | dark-slate-blue |
| slate-blue | medium-slate-blue | medium-purple | dark-magenta | dark-violet |
| dark-orchid | medium-orchid | purple | thistle | plum |
| violet | orchid | medium-violet-red | pale-violet-red | deep-pink |
| hot-pink | light-pink | pink | antique-white | beige |
| bisque | blanched-almond | wheat | corn-silk | lemon-chiffon |
| light-golden-rod-yellow | light-yellow | saddle-brown | sienna | chocolate |
| peru | sandy-brown | burly-wood | tan | rosy-brown |
| moccasin | navajo-white | peach-puff | misty-rose | lavender-blush |
| linen | old-lace | papaya-whip | sea-shell | mint-cream |
| slate-gray | light-slate-gray | light-steel-blue | lavender | floral-white |
| alice-blue | ghost-white | honeydew | ivory | azure |
| snow | dim-gray | dark-gray | silver | light-gray |
| gainsboro | white-smoke |
See Also
References
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.