mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-08-03 02:17:59 +08:00
Remove verbs from extension methods
Removed the verbs from all extension methods that manipulate properties which makes the API more succinct and easier to read. Also added implicit conversion from string to Style. As a good OSS citizen, I've obsoleted the old methods with a warning for now, so this shouldn't break anyone using the old methods.
This commit is contained in:

committed by
Patrik Svensson

parent
037a215a78
commit
041bd016a2
@ -13,28 +13,33 @@ namespace PanelExample
|
||||
AnsiConsole.Render(
|
||||
new Panel(
|
||||
new Panel(content)
|
||||
.SetBorder(BoxBorder.Rounded)));
|
||||
.Border(BoxBorder.Rounded)));
|
||||
|
||||
// Left adjusted panel with text
|
||||
AnsiConsole.Render(
|
||||
new Panel(new Text("Left adjusted\nLeft").LeftAligned())
|
||||
.Expand()
|
||||
.SquareBorder()
|
||||
.SetHeader("Left", Style.WithForeground(Color.Red)));
|
||||
.Header("Left")
|
||||
.HeaderStyle("red"));
|
||||
|
||||
// Centered ASCII panel with text
|
||||
AnsiConsole.Render(
|
||||
new Panel(new Text("Centered\nCenter").Centered())
|
||||
.Expand()
|
||||
.AsciiBorder()
|
||||
.SetHeader("Center", Style.WithForeground(Color.Green), Justify.Center));
|
||||
.Header("Center")
|
||||
.HeaderStyle("green")
|
||||
.HeaderAlignment(Justify.Center));
|
||||
|
||||
// Right adjusted, rounded panel with text
|
||||
AnsiConsole.Render(
|
||||
new Panel(new Text("Right adjusted\nRight").RightAligned())
|
||||
.Expand()
|
||||
.RoundedBorder()
|
||||
.SetHeader("Right", Style.WithForeground(Color.Blue), Justify.Right));
|
||||
.Header("Right")
|
||||
.HeaderStyle("blue")
|
||||
.HeaderAlignment(Justify.Right));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user