Skip to main content

terminal_colour

Discworld driver help

terminal_colour

Name

terminal_colour() - replaces codes in a string

Syntax

string terminal_colour( string str, mapping m );
string terminal_colour( string str, mapping m, int wrap);
string terminal_colour( string str, mapping m, int wrap,
int indent);

Description

terminal_colour() replaces each occurrence of %\^key%\^ in `str' with 'value', where 'key' and 'value' are the elements in the mapping `m'. You should not put a '\' in front of the '^' as this page suggests, this was done because this manual page is wrapped by the same system and it would replace the word otherwise :-).

`wrap' is the optional column number to wrap at, and `indent' is the amount to indent the second and following lines. Codes are assumed to change the mode of the terminal and not generate any printable characters for the purposes of wrapping.

See also

(s)printf()