Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Color Codes Reference

Complete reference for colors in Two-Face.

Color Formats

Two-Face supports multiple color format specifications:

Hex Colors

6-digit or 3-digit hexadecimal:

color = "#ff0000"   # Red (6-digit)
color = "#f00"      # Red (3-digit shorthand)
color = "#FF0000"   # Case insensitive

RGB Values

color = "rgb(255, 0, 0)"    # Red
color = "rgb(0, 128, 255)"  # Blue

Named Colors

Standard web colors:

color = "red"
color = "darkblue"
color = "forestgreen"

Preset Names

Two-Face specific presets:

color = "health"        # Health bar color
color = "mana"          # Mana bar color
color = "speech"        # Speech text color

Standard Named Colors

Basic Colors

NameHexPreview
black#000000████
white#ffffff████
red#ff0000████
green#00ff00████
blue#0000ff████
yellow#ffff00████
cyan#00ffff████
magenta#ff00ff████

Extended Colors

NameHexPreview
orange#ffa500████
pink#ffc0cb████
purple#800080████
brown#a52a2a████
gray / grey#808080████
gold#ffd700████
silver#c0c0c0████
navy#000080████
teal#008080████
olive#808000████
maroon#800000████
lime#00ff00████
aqua#00ffff████
fuchsia#ff00ff████

Dark Variants

NameHex
darkred#8b0000
darkgreen#006400
darkblue#00008b
darkcyan#008b8b
darkmagenta#8b008b
darkyellow / darkgoldenrod#b8860b
darkgray / darkgrey#a9a9a9
darkorange#ff8c00
darkviolet#9400d3

Light Variants

NameHex
lightred / lightcoral#f08080
lightgreen#90ee90
lightblue#add8e6
lightcyan#e0ffff
lightpink#ffb6c1
lightyellow#ffffe0
lightgray / lightgrey#d3d3d3
lightsalmon#ffa07a
lightseagreen#20b2aa

Bright Variants (Terminal)

NameHex
bright_black#555555
bright_red#ff5555
bright_green#55ff55
bright_yellow#ffff55
bright_blue#5555ff
bright_magenta#ff55ff
bright_cyan#55ffff
bright_white#ffffff

256-Color Palette

Standard Colors (0-15)

 0 Black       8 Bright Black
 1 Red         9 Bright Red
 2 Green      10 Bright Green
 3 Yellow     11 Bright Yellow
 4 Blue       12 Bright Blue
 5 Magenta    13 Bright Magenta
 6 Cyan       14 Bright Cyan
 7 White      15 Bright White

Color Cube (16-231)

6x6x6 color cube:

  • R: 0, 95, 135, 175, 215, 255
  • G: 0, 95, 135, 175, 215, 255
  • B: 0, 95, 135, 175, 215, 255

Index = 16 + 36×r + 6×g + b (where r,g,b are 0-5)

Grayscale (232-255)

24 shades from dark to light:

RangeDescription
232-235Near black
236-243Dark gray
244-251Light gray
252-255Near white

Two-Face Presets

Vitals Presets

PresetDefaultUsage
health#00ff00Health bar (full)
health_low#ffff00Health bar (low)
health_critical#ff0000Health bar (critical)
mana#0080ffMana bar
stamina#ff8000Stamina bar
spirit#ff00ffSpirit bar

Stream Presets

PresetDefaultUsage
main#ffffffMain game text
room#ffff00Room descriptions
combat#ff4444Combat messages
speech#00ffffCharacter speech
whisper#ff00ffPrivate messages
thoughts#00ff00Mental communication

UI Presets

PresetDefaultUsage
background#000000Window background
text#c0c0c0Default text
text_dim#808080Dimmed text
border#404040Widget borders
border_focused#ffffffFocused widget border

Status Presets

PresetDefaultUsage
hidden#00ff00Hidden indicator
invisible#00ffffInvisible indicator
stunned#ffff00Stunned indicator
webbed#ff00ffWebbed indicator
prone#00ffffProne indicator
kneeling#ff8000Kneeling indicator
sitting#808080Sitting indicator
dead#ff0000Dead indicator

Color Modes

True Color (24-bit)

16.7 million colors:

[display]
color_mode = "truecolor"

256 Colors

256-color palette:

[display]
color_mode = "256"

Colors are mapped to nearest palette entry.

16 Colors

Basic terminal colors:

[display]
color_mode = "16"

No Color

Monochrome:

[display]
color_mode = "none"

Color Math

Brightness/Luminance

Calculate perceived brightness:

L = 0.299×R + 0.587×G + 0.114×B

Contrast Ratio

For accessibility:

Ratio = (L1 + 0.05) / (L2 + 0.05)

WCAG guidelines:

  • 4.5:1 minimum for normal text
  • 3:1 minimum for large text
  • 7:1 enhanced contrast

Color Mixing

Linear interpolation:

mixed = color1 × (1-t) + color2 × t

Accessibility Colors

High Contrast Pairs

BackgroundForegroundRatio
#000000#ffffff21:1
#000000#ffff0019.6:1
#000000#00ffff16.7:1
#000000#00ff0015.3:1
#1a1a1a#ffffff16.9:1
#1a1a1a#e0e0e012.6:1

Color Blindness Friendly

Avoid relying solely on red/green distinction:

# Instead of red/green for health
[theme]
health = "#00ff00"
health_critical = "#ff00ff"  # Magenta instead of red

# Or use brightness difference
health = "#80ff80"           # Bright green
health_critical = "#800000"  # Dark red (brightness contrast)

Terminal Compatibility

ANSI Escape Sequences

16 colors:

\e[30m - \e[37m   # Foreground colors
\e[40m - \e[47m   # Background colors
\e[90m - \e[97m   # Bright foreground
\e[100m - \e[107m # Bright background

256 colors:

\e[38;5;Nm  # Foreground (N = 0-255)
\e[48;5;Nm  # Background

True color:

\e[38;2;R;G;Bm  # Foreground (R,G,B = 0-255)
\e[48;2;R;G;Bm  # Background

Terminal Detection

# Check color support
echo $TERM
echo $COLORTERM
tput colors

See Also