applyTruecolour

Produces a terminal colour token for the colour passed, expressed in terms of red, green and blue, then writes it to the passed output range.

version(Colours)
void
applyTruecolour
(
Sink
)
(
auto ref Sink sink
,
uint r
,
uint g
,
uint b
,
const bool brightTerminal = false
,
const bool normalise = true
)

Parameters

sink Sink

Output range to write the final code into.

r uint

Red value.

g uint

Green value.

b uint

Blue value.

normalise bool

Whether or not to normalise colours so that they aren't too dark or too bright.

Examples

Appender!(char[]) sink;
int r, g, b;
numFromHex("3C507D", r, g, b);
sink.applyTruecolour(r, g, b);
sink.put("Foo");
sink.applyANSI(TerminalReset.all);
writeln(sink);  // "Foo" in #3C507D