Search code examples
terminalcolor-schemexorg

Xresources and colors


When seeking xterminal themes, one can find plenty with just a google search.

Here is a one:

*background: rgb:00/00/00

*foreground: rgb:a8/a8/a8

*color0: rgb:00/00/00

*color1: rgb:a8/00/00

*color2: rgb:00/a8/00

*color3: rgb:a8/54/00

*color4: rgb:00/00/a8

*color5: rgb:a8/00/a8

*color6: rgb:00/a8/a8

*color7: rgb:a8/a8/a8

*color8: rgb:54/50/54 *color9: rgb:f8/54/50 *color10: rgb:50/fc/50 *color11: rgb:f8/fc/50 *color12: rgb:50/54/f8 *color13: rgb:f8/54/f8 *color14: rgb:50/fc/f8 *color15: rgb:f8/fc/f8

So the background and foreground colors seem legitimate, however, what are the colors ranging from 0 to 15 for ? I can suppose programs like ls use them, since changing those 16 colors affect 'ls --color' output.

I'd be grateful if one could enlight my view of what those colors are or are for and how they affect colorschemes.


Solution

  • The names color0 through color15 are xterm resource names, which correspond to the ANSI (0-7) and aixterm-like (8-15) colors set using escape sequences. The resource names are listed in the xterm manual page, and the escape sequences in the XTerm Control Sequences. Various applications use these escape sequences, either via a library such as ncurses, or hardcoded. (GNU ls is in between -- it does not use the regular terminal database, but has its own different one which is a nuisance).

    They are resources so that users can easily customize the color palette. For instance, the exact shade of blue used has been a matter of dispute.

    There "could" be names for the resources for colors 16-255, except that there is a limit of 400 resource names in the X libraries (so xterm does not provide those names -- it grew past that limit in 2004).