Add an example showing the decorations off (#1191)

This commit is contained in:
Fraser Waters
2023-09-16 22:08:52 +01:00
committed by GitHub
parent ed9e198d60
commit 2af3f7faeb
3 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,29 @@
using Spectre.Console;
namespace Colors;
public static class Program
{
public static void Main()
{
AnsiConsole.ResetDecoration();
AnsiConsole.WriteLine();
if (AnsiConsole.Profile.Capabilities.Ansi)
{
AnsiConsole.Write(new Rule("[bold green]ANSI Decorations[/]"));
}
else
{
AnsiConsole.Write(new Rule("[bold red]Legacy Decorations (unsupported)[/]"));
}
var decorations = System.Enum.GetValues(typeof(Decoration));
foreach (var decoration in decorations)
{
var name = System.Enum.GetName(typeof(Decoration),decoration);
AnsiConsole.Write(name + ": ");
AnsiConsole.Write(new Markup(name+"\n", new Style(decoration: (Decoration)decoration)));
}
}
}