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, brightTerminal: false); immutable errtintString = errtint.asANSI;
static immutable LogLevel[4] logLevels = [ LogLevel.all, LogLevel.info, LogLevel.warning, LogLevel.fatal, ]; foreach (immutable logLevel; logLevels[]) { import std.format : format; immutable tintBright = tint(logLevel, brightTerminal: true); immutable tintBrightTable = logcoloursBright[logLevel]; assert((tintBright == tintBrightTable), "%s != %s" .format(tintBright, tintBrightTable)); immutable tintDark = tint(logLevel, brightTerminal: false); 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.