ircColour

Colour-codes the passed string with mIRC colouring, foreground and background. Direct overload that leverages the output range version to colour an internal Appender, and returns the resulting string.

  1. string ircColour(string line, int fg, int bg)
    @safe pure
    string
    ircColour
    (
    const string line
    ,
    const int fg
    ,
    const int bg = IRCColour.unset
    )
  2. string ircColour(IRCColour fg, IRCColour bg)

Parameters

line string

Line to tint.

fg int

Foreground IRCColour integer.

bg int

Optional background IRCColour integer.

Return Value

Type: string

The passed line, encased within IRC colour tags.

Examples

alias I = IRCControlCharacter;

immutable redwhite = "kameloso".ircColour(IRCColour.red, IRCColour.white);
assert((redwhite == I.colour ~ "04,00kameloso" ~ I.colour), redwhite);

immutable green = "harbl".ircColour(IRCColour.green);
assert((green == I.colour ~ "03harbl" ~ I.colour), green);