[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13. Colors

When specifying a color, it is possible to use its X11 Color Name (usually in the file ‘/etc/X11/rgb.txt’). You can also use a six digit hex string prefixed by a ’#’ character in the same way that you can specify colors in HTML.

All text printed by stumpwm is run through a coloring engine before being displayed. All color commands start with a ‘^’ (caret) character and apply to all text after it.

^0-9

A caret followed by a single digit number changes the foreground color to the specified color. A ‘*’ can be used to specify the normal color. See the color listing below.

^0-90-9

A caret followed by two digits sets the foreground and background color. The first digit refers to the foreground color and the second digit to the background color. A ‘*’ can be used in place of either digit to specify the normal color. See the color listing below.

^B

Turn on bright colors.

^b

Turn off bright colors.

^n

Use the normal background and foreground color.

^R

Reverse the foreground and background colors.

^r

Turn off reverse colors.

^[

Push the current colors onto the color stack. The current colors remain unchanged.

^]

Pop the colors off the color stack.

^>

Align the rest of the line to the right of the window.

^f<n>

Sets the current font to the font at index n in the screen’s font list.

^(<modifier> &rest arguments)

Allows for more complicated color settings: <modifier> can be one of :fg, :bg, :reverse, :bright, :push, :pop, :font and :>. The arguments for each modifier differ:

^^

Print a regular caret.

The default colors are made to resemble the 16 VGA colors and are:

0 black
1 red
2 green
3 yellow
4 blue
5 magenta
6 cyan
7 white

There are only 8 colors by default but 10 available digits. The last two digits are left up to the user. Behind The Scenes Look At Colors for information on customizing colors.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.1 Behind The Scenes Look At Colors

Color indexes are stored in *colors* as a list. The default list of colors leave 2 slots for the user to choose. If you’d like to use ‘Papaya Whip’ and ‘Dark Golden Rod 3’ you might eval the following:

 
(setf *colors* (append *colors*
                       (list "PapayaWhip"
                             "DarkGoldenRod3")))
(update-color-map (current-screen))

Of course, you can change all the colors if you like.

Function: parse-color-string string

Parse a color-coded string into a list of strings and color modifiers

Function: uncolorify string

Remove any color markup in STRING

Variable: *colors*

Eight colors by default. You can redefine these to whatever you like and then call (update-color-map).

Function: update-color-map screen

Read *colors* and cache their pixel colors for use when rendering colored text.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by David Bjergaard on January 12, 2017 using texi2html 1.82.