Skip to content

Text Attributes supported in Config files

c-blake edited this page Jul 29, 2023 · 5 revisions

Text Attributes supported in Config files

cligen supports multiple keywords for specifying text coloring and styling in the terminal (see ANSI escape codes) in the [color] section of its config files.

Regular colors
Regular color keywords are in lower case. Examples: black, red, green, yellow, blue, purple, cyan, white
Bright bank colors
Keywords for “bright bank” colors are in upper case. Examples: BLACK, RED, GREEN, YELLOW, BLUE, PURPLE, CYAN, WHITE
Foreground vs Background
By default, the color keywords specify the foreground color. Prefixing those color keywords makes that a background color specification. Example: on_red specifies red background.
More colors
256-color or true color terminals like xterm and st can also support 256-color xterm attrs in these formats:
  • {fbu}[0..23] for F)ORE/B)ACKgrnd/U)NDER grey scale
  • {fbu}RGB where R, G, B are in 0..5
  • {fbu}RRGGBB with RR, GG, BB are in hexadecimal (true color)

The ‘u’ is for the foreground color of underFoo pixels which some terminals like kitty allow setting seperately.

Color scales like Veridis
  • {fbu}sNAME<0.0-1.0>[,..]: element of NAME: viridis hue[,s,v] wLen[,s,v] gray pm3d
  • only hue and wLen (waveLength) take optional saturation,value alterations
Styling
The styling keywords can be used alone or in combination with the color keywords. Supported keywords: bold, faint, italic, underline, inverse, struck, blink (slow), BLINK (fast); underdot, underdash, underdouble, undercurl These can all be prefixed by a minus sign (-) for the “turn-it-off attribute”. E.g. -bold turns off bold. -underline turns off all the under-styles (which are also mutually exclusive).
No color
Use the NONE (or off or none or plain) keywords to turn off attributes (color or styling) for subsequent text.

Examples

The cligen config variables in the [color] section can accept these text attribute keywords in multiple combinations. See some examples below:

Example Description
green green foreground
on_CYAN bright cyan background
YELLOW on_red yellow on red background
NONE no colors or styling
bold red bold red

Example config files

See ~configs/~ directory in this repo.