color
The color
type supports a variety of formats.
Here are some examples of settings colors as environment variables:
In its simplest form, you specify one of:
-
Named colors, which are mapped to the 3-bit and 4-bit ANSI colors:
black, red, green, brown, yellow, blue, magenta, purple, cyan, white, hiblack, lightblack, darkgray, gray, darkgrey, grey, hired, lightred, higreen, lightgreen, lime, hibrown, lightbrown, hiyellow, lightyellow, gold, hiblue, lightblue, himagenta, lightmagenta, hipurple, lightpurple, hicyan, lightcyan, hiwhite, lightwhite
These colors depend on your terminal’s color settings. So if your terminal is configured with “Dracula” theme, then the
red
color name will be the “Dracula” variant of red. -
A single 256-color number:
5
(magenta)82
(a light lime color)240
(dark gray)
-
Hexadecimal: (case insensitive)
#aaff00
aaff00
0xaaff00
#af0
af0
-
RGB, with values ranging from 0 to 255, in two different syntaxes:
192, 255, 238
rgb(192, 255, 238)
-
Raw escape data, in case you know what escape code you’re looking for.
raw(53)
(overlined)raw(4;53)
(underlined & overlined)
By default the value refers to the foreground color (text color).
The full syntax would be fg=red
But you can also set the background color by adding in bg=
, such as bg=blue
.
To set both foreground and background, you join together the colors with
a colon :
, like so: fg=red:bg=blue
In addition, you can also apply style modifiers:
bold
, orb
: Bold text styling, such as thisfuzzy
: Faint text style (inverse of bold)italic
,i
: Italic text, such as thisunderline
, oru
: Underlined text, such as thisblink
: Blinking text. Not widely supported by terminals.fastblink
: Rapid blinking text. Not widely supported by terminals.reverse
,invert
: Swaps foreground and background colorsconcealed
,hidden
,invisible
: Hidden text. Not widely supported.strikethrough
: Crossed out text,such as this
Lastly, whitespace is allowed in the color codes:
See also: color[]
type