Next: , Up: Terminal   [Contents][Index]


18.16.1 Terminal Colors

At every moment the text terminal is configured to use certain foreground and background colors. Initially, these are the default colors, which depend on the underlying terminal capabilities, and maybe also on some system wide configuration setting.

Terminal colors are encoded in triplets of integers signifying RGB colors, i.e. levels of beams for red, green and blue. These triplets are implemented as values of type int<32>[3].

The special value [-1, -1, -1] means the default color, for both foreground and background. There are two predefined variables for this:

var term_default_color = [-1,-1,-1];
var term_default_bgcolor = [-1,-1,-1];

Getting and setting the foreground and background colors is performed using the term_get_color, term_set_color, term_get_fgcolor and term_set_fgcolor functions, with signatures:

fun term_get_color = int<32>[3]
fun term_set_color = (int<32>[3] color) void
fun term_get_bgcolor = int<32>[3]
fun term_set_bgcolor = (int<32>[3] color) void