예제 #1
0
 public static T SetColors <T>(this T element, ColorSet colors)
     where T : Element
 {
     element.Background = colors.GetEffectiveBackground();
     element.Color      = colors.GetEffectiveForeground();
     return(element);
 }
예제 #2
0
            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);
            }
예제 #3
0
 public static IConsole WriteLineColored(this IConsole console, string text, ColorSet colorSet)
 {
     return(console.WriteLineColored(text, colorSet?.GetEffectiveForeground(), colorSet?.GetEffectiveBackground()));
 }