mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-14 16:02:50 +08:00
Add background color examples in Sample console
This commit is contained in:
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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user