ansi/color
src/ansi/color.tur
4-bit, 8-bit, and 24-bit foreground / background colors.
defn
fg4
(fg4 [color-idx : int])
emit a 4-bit foreground color SGR (0-15).
Parameters
| color-idx | 0-7 standard, 8-15 bright. Out-of-range values are | |
| clamped to [0, 15]. |
Example
(fg4 1) ; bright-... no, 1 = red. Use (color-bright-red) for index 9.
Since: tur-ansi AN1
defn
bg4
(bg4 [color-idx : int])
emit a 4-bit background color SGR (0-15).
defn
fg8
(fg8 [idx : int])
emit an 8-bit (256-color palette) foreground SGR.
Parameters
| idx | 0-255 palette index. Clamped to [0, 255]. |
defn
bg8
(bg8 [idx : int])
emit an 8-bit (256-color palette) background SGR.
defn
fg24
(fg24 [r : int g : int b : int])
emit a 24-bit (true-color) foreground SGR.
Parameters
| r, g, b -- 0-255 channels. Clamped to [0, 255]. |
defn
bg24
(bg24 [r : int g : int b : int])
emit a 24-bit (true-color) background SGR.
defn
color-reset
(color-reset)
restore default foreground and background (SGR 39 49).
defn
color-black
(color-black)
defn
color-red
(color-red)
defn
color-green
(color-green)
defn
color-yellow
(color-yellow)
defn
color-blue
(color-blue)
defn
color-magenta
(color-magenta)
defn
color-cyan
(color-cyan)
defn
color-white
(color-white)
defn
color-bright-black
(color-bright-black)
defn
color-bright-red
(color-bright-red)
defn
color-bright-green
(color-bright-green)
defn
color-bright-yellow
(color-bright-yellow)
defn
color-bright-blue
(color-bright-blue)
defn
color-bright-magenta
(color-bright-magenta)
defn
color-bright-cyan
(color-bright-cyan)
defn
color-bright-white
(color-bright-white)
defn
color4
(color4 [idx : int] :)
box a 4-bit palette index (0-15) as a `Color4` value.
defn
color8
(color8 [idx : int] :)
box an 8-bit palette index (0-255) as a `Color8` value.
defn
rgb
(rgb [r : int g : int b : int] :)
box a 24-bit RGB triple (each 0-255) as a `Color24` value.
Internal definitions
Color4-- a 4-bit (16-color) palette color. `idx` is 0-15.Color8-- an 8-bit (256-color) palette color. `idx` is 0-255.Color24-- a 24-bit (true-color) RGB color. Channels are 0-255.Color[Color4]Color[Color8]Color[Color24]