Colors
DDA is colorful game. You can use several foreground and background colors in various places:
- map data (terrain and furniture);
- item data;
- text data;
- etc.
Note: Map data objects can only have one color-related node defined (either color
or bgcolor
).
Color string format
Whenever color is defined in JSON it should be defined in following format: Prefix_Foreground_Background
.
Prefix
can take one of following values:
c_
- default color prefix (can be omitted);i_
- optional prefix which indicates that foreground color should be inverted (special rules will be applied to foreground and background colors);h_
- optional prefix which indicates that foreground color should be highlighted (special rules will be applied to foreground and background colors).
Foreground
- defines mandatory color of foreground/ink/font.
Background
- defines optional color of background/paper.
Note: Not all foreground + background pairs are defined by their full name. Use in-game Color manager to see all color names.
Note: If color was not found by its name, then c_unset
is used for Foreground
and i_white
for Background
.
Examples of color strings
c_white
-white
color (with default prefixc_
);black
-black
color (default prefixc_
is omitted);i_red
- invertedred
color;dark_gray_white
-dark_gray
foreground color withwhite
background color;light_gray_light_red
-light_gray
foreground color withlight_red
background color;dkgray_red
-dark_gray
foreground color withred
background color (deprecated prefixdk
instead ofdark_
);ltblue_red
-light_blue
foreground color withred
background color (deprecated prefixlt
instead oflight_
).
Color code
Color code is short string which defines color and can be used, for example, in maps notes.
Possible colors
Color (image) | Color name (dda) | Color name (curses) | Default R,G,B values | Color code | Notes |
---|---|---|---|---|---|
black | BLACK | 0,0,0 | |||
red | RED | 255,0,0 | R | ||
green | GREEN | 0,110,0 | G | ||
brown | BROWN | 92,51,23 | br | ||
blue | BLUE | 0,0,200 | B | ||
magenta | MAGENTA | 139,58,98 | P | ||
cyan | CYAN | 0,150,180 | C | ||
light_gray | GRAY | 150,150,150 | lg | deprecated lt prefix can be used instead of light_ | |
dark_gray | DGRAY | 99,99,99 | dg | deprecated dk prefix can be used instead of dark_ | |
light_red | LRED | 255,150,150 | deprecated lt prefix can be used instead of light_ | ||
light_green | LGREEN | 0,255,0 | g | deprecated lt prefix can be used instead of light_ | |
yellow | YELLOW | 255,255,0 | |||
light_blue | LBLUE | 100,100,255 | b | deprecated lt prefix can be used instead of light_ | |
pink | LMAGENTA | 254,0,254 | lm | ||
light_cyan | LCYAN | 0,240,255 | c | deprecated lt prefix can be used instead of light_ | |
white | WHITE | 255,255,255 | W |
Note: Default RGB values are taken from file \data\raw\colors.json
. Note: RGB values can be redefined in file \config\base_colors.json
.
Color rules
There are two types of special color transformation which can affect both foreground and background color:
- inversion;
- highlight.
Note: Color rules can be redefined (for example, \data\raw\color_templates\no_bright_background.json
).
Color tags
Color tags can be used in most places where strings can be displayed to the player:
"name": "[Ψ]Stop Concentrating",
"description": "End your concentration on all of your maintained powers.\n\nChanneling this power <color_green>always succeeds</color>.",
"text": [
"<color_light_blue>You see a Russian sheepdog off at the edge of your vision. It walks past some scenery and vanishes.</color>"
]
and
{ "u_message": "The <color_light_green>zombie</color> bursts in <color_red>flames!</color>", "type": "mixed" }
will be displayed respectively as:
and
Do note how the color tags override the default color for a "mixed"
dialogue message (magenta
). This is not always the case, so it requires testing to find out the intended combination.
Additionally, color tags can be combined to generate color gradients, and be nested into each other:
{ "u_message": "<color_red>H</color><color_magenta>ell</color><color_red>fire</color> and brimstone." },
{ "u_message": "<color_light_gray><color_white>This text is white</color> while this text is light_gray, <color_light_red>this is light_red</color>. This is light_gray again</color>", "type": "mixed" }
which are displayed as:
Note: Items that use relic data
automatically turn the item’s displayed name in pink
. Color tags override this, in case one wants to “hide” it from the player, or to make them look “mundane”. Similarly, if one wants, otherwise mundane items can have colored names.