color

Wraps a string around color escape sequences.

  1. string color(string str, fg c, bg b, mode m)
    pure
    string
    color
    (
    const string str
    ,
    const fg c = fg.init
    ,
    const bg b = bg.init
    ,
    const mode m = mode.init
    )
  2. alias color = background
  3. alias color = foreground
  4. alias color = style
  5. alias color = colorHelper

Parameters

str string

The string to wrap with colors and modes

c fg

The foreground color (see the fg enum type)

b bg

The background color (see the bg enum type)

m 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