Guile Library

(term ansi-color)

Overview

The (term ansi-color) module generates ANSI escape sequences for colors. Here is an example of the module's use:

 method one: safer, since you know the colors
 will get reset
(display (colorize-string "Hello!\n" 'RED 'BOLD 'ON-BLUE))

 method two: insert the colors by hand
(for-each display
          (list (color 'RED 'BOLD 'ON-BLUE)
                "Hello!"
                 (color 'RESET)))

Usage

color . lst
[Function]

Returns a string containing the ANSI escape sequence for producing the requested set of attributes.

The allowed values for the attributes are listed below. Unknown attributes are ignored.

Reset Attributes

CLEAR and RESET are allowed and equivalent.

Non-Color Attributes

BOLD makes text bold, and DARK reverses this. UNDERLINE and UNDERSCORE are equivalent. BLINK makes the text blink. REVERSE invokes reverse video. CONCEALED hides output (as for getting passwords, etc.).

Foregrond Color Attributes

BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE

Background Color Attributes

ON-BLACK, ON-RED, ON-GREEN, ON-YELLOW, ON-BLUE, ON-MAGENTA, ON-CYAN, ON-WHITE

colorize-string str . color-list
[Function]

Returns a copy of str colorized using ANSI escape sequences according to the attributes specified in color-list. At the end of the returned string, the color attributes will be reset such that subsequent output will not have any colors in effect.

The allowed values for the attributes are listed in the documentation for the color function.