mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 00:42:51 +08:00
Update rule example and docs
This commit is contained in:
parent
bca1c889d1
commit
93d1971f48
Binary file not shown.
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 24 KiB |
@ -5,7 +5,7 @@ RedirectFrom: rule
|
||||
|
||||
The `Rule` class is used to render a horizontal rule (line) to the terminal.
|
||||
|
||||

|
||||
<img src="../assets/images/rule.png" style="width: 100%;" />
|
||||
|
||||
# Usage
|
||||
|
||||
|
@ -14,26 +14,26 @@ namespace EmojiExample
|
||||
|
||||
// Left aligned title
|
||||
WrapInPanel(
|
||||
new Rule("[white]Left aligned[/]")
|
||||
new Rule("[blue]Left aligned[/]")
|
||||
.RuleStyle(Style.Parse("red"))
|
||||
.LeftAligned());
|
||||
|
||||
// Centered title
|
||||
WrapInPanel(
|
||||
new Rule("[silver]Centered[/]")
|
||||
new Rule("[green]Centered[/]")
|
||||
.RuleStyle(Style.Parse("green"))
|
||||
.Centered());
|
||||
|
||||
// Right aligned title
|
||||
WrapInPanel(
|
||||
new Rule("[grey]Right aligned[/]")
|
||||
new Rule("[red]Right aligned[/]")
|
||||
.RuleStyle(Style.Parse("blue"))
|
||||
.RightAligned());
|
||||
}
|
||||
|
||||
private static void WrapInPanel(Rule rule)
|
||||
{
|
||||
AnsiConsole.Render(new Panel(rule).Expand().BorderStyle(Style.Parse("grey")));
|
||||
AnsiConsole.Render(rule);
|
||||
AnsiConsole.WriteLine();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user