Module colorizer.parser.ls_colors
LSCOLORS Parser
Parses LSCOLORS / SGR color-producing snippets such as:
- =NN plain 8-color (30-37 fg, 40-47 bg)
- =NN bright 8-color (90-97 fg, 100-107 bg)
- =01;NN bold-promoted fg becomes the bright variant
- =38;5;NNN / =48;5;NNN 256-color
- =38;2;R;G;B / =48;2;R;G;B truecolor
Walks semicolon-separated codes starting after = until a non-digit /
non-semicolon byte (typically : or whitespace).
Foreground wins when both are present. 256-color values reuse the xterm palette so users do not need to duplicate it in custom parsers.
Functions
| parser (line, i) | Parse an LS_COLORS/SGR color snippet starting at i in line. |