aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc_src/set_color.txt
blob: 98f4f8ed8c761f96a3028a90f2f6880cf8b65648 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
\section set_color set_color - set the terminal color

\subsection set_color-synopsis Synopsis
\fish{synopsis}
set_color [OPTIONS] [COLOR]
\endfish

\subsection set_color-description Description

`set_color` changes the foreground and/or background color of the terminal. `COLOR` is one of `black`, `red`, `green`, `brown`, `yellow`, `blue`, `magenta`, `purple`, `cyan`, `brred`, `brgreen`, `brbrown`, `bryellow`, `brblue`, `brmagenta`, `brpurple`, `brcyan`, `white`. The `br`, bright, forms are most useful as background colors. The special color `normal` resets the background and foreground to whatever is normal for your terminal.

If your terminal supports term256 (modern xterms and OS X Terminal and iTerm2), you can specify an RGB value with three or six hex digits, such as A0FF33 or f2f. `fish` will choose the closest supported color. A three digit value is equivalent to specifying each digit twice; e.g., `#2BC` is the same as `#22BBCC`. Hex RGB values can be in lower or uppercase, optionally prefixed with the pound-sign character.

The following options are available:

- `-b`, `--background` `COLOR` sets the background color.

- `-c`, `--print-colors` prints a list of all valid color names.

- `-o`, `--bold` sets bold or extra bright mode.

- `-u`, `--underline` sets underlined mode.


Calling `set_color normal` will set the terminal background and foreground colors to the defaults for the terminal.

Some terminals use the `--bold` escape sequence to switch to a brighter color set rather than bolding the characters.

Not all terminal emulators support all these features.

`set_color` uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it.

Note that setting either color to "normal" will reset both background and foreground colors.

\subsection set_color-example Examples

\fish
set_color red; echo "Roses are red"
set_color blue; echo "Violets are blue"
set_color 62A; echo "Eggplants are dark purple"
set_color normal; echo "Normal is nice" # This will reset background, too
\endfish