mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-19 02:12:49 +08:00

Adds a new rule widget. Also fixes some bugs I encountered while testing some unrelated things in an extremely small console.
29 lines
793 B
C#
29 lines
793 B
C#
using Spectre.Console;
|
|
|
|
namespace EmojiExample
|
|
{
|
|
public static class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
// No title
|
|
Render(new Rule().SetStyle("yellow"));
|
|
|
|
// Left aligned title
|
|
Render(new Rule("[white]Left aligned[/]").LeftAligned().SetStyle("red"));
|
|
|
|
// Centered title
|
|
Render(new Rule("[silver]Centered[/]").Centered().SetStyle("green"));
|
|
|
|
// Right aligned title
|
|
Render(new Rule("[grey]Right aligned[/]").RightAligned().SetStyle("blue"));
|
|
}
|
|
|
|
private static void Render(Rule rule)
|
|
{
|
|
AnsiConsole.Render(new Panel(rule).Expand().SetBorderStyle(Style.Parse("grey")));
|
|
AnsiConsole.WriteLine();
|
|
}
|
|
}
|
|
}
|