mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 17:02: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.
|
The `Rule` class is used to render a horizontal rule (line) to the terminal.
|
||||||
|
|
||||||

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