to

Converts any suitable data type into an AnsiColour.

Parameters

colour CT

The colour to convert.

Return Value

An AnsiColour created from the given colour.

Examples

static struct RGB
{
    ubyte r;
    ubyte g;
    ubyte b;
}

assert(RGB(255, 128, 64).to!AnsiColour == AnsiColour(255, 128, 64));
static struct RGB
{
    ubyte r;
    ubyte g;
    ubyte b;
}

assert(RGB(255, 128, 64).toBg == AnsiColour(255, 128, 64, IsBgColour.yes));

See Also

isUserDefinedRgbType

Meta