Exemple #1
0
 public void Dispose()
 {
     GC.SuppressFinalize(this);
     _console.SetColor(_style.Foreground, true);
     _console.SetColor(_style.Background, false);
     _console.Decoration = _style.Decoration;
 }
Exemple #2
0
        public static IDisposable PushStyle(this IAnsiConsole console, Style style)
        {
            if (console is null)
            {
                throw new ArgumentNullException(nameof(console));
            }

            if (style is null)
            {
                throw new ArgumentNullException(nameof(style));
            }

            var current = new Style(console.Foreground, console.Background, console.Decoration);

            console.SetColor(style.Foreground, true);
            console.SetColor(style.Background, false);
            console.Decoration = style.Decoration;
            return(new StyleScope(console, current));
        }
Exemple #3
0
        public static IDisposable PushColor(this IAnsiConsole console, Color color, bool foreground)
        {
            if (console is null)
            {
                throw new ArgumentNullException(nameof(console));
            }

            var current = foreground ? console.Foreground : console.Background;

            console.SetColor(color, foreground);
            return(new ColorScope(console, current, foreground));
        }
Exemple #4
0
 public void Dispose()
 {
     GC.SuppressFinalize(this);
     _console.SetColor(_color, _foreground);
 }