String to tint.
Red value.
Green value.
Blue value.
Whether the terminal has a bright background or not.
Whether or not to normalise colours so that they aren't too dark or too bright.
The passed string word encompassed by terminal colour tags.
string foo = "Foo Bar".asTruecolour(172, 172, 255); int r, g, b; numFromHex("003388", r, g, b); string bar = "Bar Foo".asTruecolour(r, g, b);
import std.format : format; immutable name = "blarbhl".asTruecolour(255, 255, 255, No.brightTerminal, No.normalise); immutable alsoName = "%c[38;2;%d;%d;%dm%s%c[0m" .format(cast(char)TerminalToken.format, 255, 255, 255, "blarbhl", cast(char)TerminalToken.format); assert((name == alsoName), alsoName);
Produces a terminal colour token for the colour passed, expressed in terms of red, green and blue. Convenience function to colour a piece of text without being passed an output sink to fill into.