applyANSI

Applies an ANSI code to a passed output range.

version(Colours)
void
applyANSI
(
Sink
)
(
auto ref Sink sink
,
const uint code
,)
if (
isOutputRange!(Sink, char[])
)

Parameters

sink Sink

Output range sink to write to.

code uint

ANSI code to apply.

overrideType ANSICodeType

Force a specific ANSICodeType in cases where there is ambiguity.

Examples

Appender!(char[]) sink;

sink.put("Hello ");
sink.applyANSI(TerminalForeground.red, ANSICodeType.foreground);
sink.put("world!");
sink.applyANSI(TerminalForeground.default_, ANSICodeType.foreground);

Meta