public static T SetColors <T>(this T element, ColorSet colors) where T : Element { element.Background = colors.GetEffectiveBackground(); element.Color = colors.GetEffectiveForeground(); return(element); }
private (ConsoleColor bg, ConsoleColor fg) GetColors(ColorScheme scheme, string name, ColorSet fallback) { if (scheme.LogColors == null || !scheme.LogColors.TryGetValue(name, out var colorSet)) { colorSet = fallback; } var bg = colorSet?.GetEffectiveBackground() ?? fallback.GetEffectiveBackground(); var fg = colorSet?.GetEffectiveForeground() ?? fallback.GetEffectiveForeground(); return(bg, fg); }
public static IConsole WriteLineColored(this IConsole console, string text, ColorSet colorSet) { return(console.WriteLineColored(text, colorSet?.GetEffectiveForeground(), colorSet?.GetEffectiveBackground())); }