color

Wraps a string around color escape sequences.

string
color
pure
(
const string str
,
const fg c = fg.init
,
const bg b = bg.init
,
const mode m = mode.init
)

Parameters

str
Type: string

The string to wrap with colors and modes

c
Type: fg

The foreground color (see the fg enum type)

b
Type: bg

The background color (see the bg enum type)

m
Type: mode

The text mode (see the mode enum type)

Examples

writeln("This is blue".color(fg.blue));
writeln(
 color("This is red over green blinking", fg.blue, bg.green, mode.blink)
);

Meta