mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-10-25 15:19:23 +00:00
Add background color examples in Sample console
This commit is contained in:
committed by
Patrik Svensson
parent
5cd9ece31a
commit
0b4321115a
@@ -18,12 +18,23 @@ namespace Sample
|
||||
AnsiConsole.WriteLine();
|
||||
|
||||
// We can also use System.ConsoleColor with AnsiConsole.
|
||||
// To set the Foreground color
|
||||
foreach (ConsoleColor value in Enum.GetValues(typeof(ConsoleColor)))
|
||||
{
|
||||
AnsiConsole.Foreground = value;
|
||||
AnsiConsole.WriteLine("ConsoleColor.{0}", value);
|
||||
AnsiConsole.WriteLine("Foreground: ConsoleColor.{0}", value);
|
||||
}
|
||||
|
||||
AnsiConsole.WriteLine();
|
||||
AnsiConsole.Foreground = Color.Chartreuse2;
|
||||
// As well as the background color
|
||||
foreach (ConsoleColor value in Enum.GetValues(typeof(ConsoleColor)))
|
||||
{
|
||||
AnsiConsole.Background = value;
|
||||
AnsiConsole.WriteLine("Background: ConsoleColor.{0}", value);
|
||||
}
|
||||
AnsiConsole.Reset();
|
||||
|
||||
// We can get the default console via the static API.
|
||||
var console = AnsiConsole.Console;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user