The LogLevel of the colour we want to scry.
Whether the colour should be for a bright terminal background or a dark one.
A TerminalForeground of the right colour. Use with asANSI to get a string.
TerminalForeground errtint = KamelosoLogger.tint(LogLevel.error, No.brightTerminal); immutable errtintString = errtint.asANSI;
import std.range : only; auto range = only( LogLevel.all, LogLevel.info, LogLevel.warning, LogLevel.fatal); foreach (immutable logLevel; range) { import std.format : format; immutable tintBright = tint(logLevel, Yes.brightTerminal); immutable tintBrightTable = logcoloursBright[logLevel]; assert((tintBright == tintBrightTable), "%s != %s" .format(tintBright, tintBrightTable)); immutable tintDark = tint(logLevel, No.brightTerminal); immutable tintDarkTable = logcoloursDark[logLevel]; assert((tintDark == tintDarkTable), "%s != %s" .format(tintDark, tintDarkTable)); }
Returns the corresponding TerminalForeground for the LogLevel, taking into account whether the terminal is said to be bright or not.
This is merely a convenient wrapping for logcoloursBright and logcoloursDark.