mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-18 13:03:21 +08:00
Add documentation for TextPath
widget (#757)
This commit is contained in:
@ -0,0 +1,44 @@
|
||||
using DocExampleGenerator;
|
||||
using Spectre.Console;
|
||||
|
||||
namespace Generator.Commands.Samples
|
||||
{
|
||||
internal class TextPathSample : BaseSample
|
||||
{
|
||||
public override (int Cols, int Rows) ConsoleSize => (40, 23);
|
||||
|
||||
public override void Run(IAnsiConsole console)
|
||||
{
|
||||
console.Write(
|
||||
new Panel(
|
||||
new Padder(new TextPath("C:/This/Is/A/Super/Long/Path/That/Will/Be/Truncated.txt"), new Padding(0,1)))
|
||||
.BorderStyle(new Style(foreground: Color.Grey))
|
||||
.Header("Windows path"));
|
||||
|
||||
console.Write(
|
||||
new Panel(
|
||||
new Padder(new TextPath("/This/Is/A/Super/Long/Path/That/Will/Be/Truncated.txt"), new Padding(0,1)))
|
||||
.BorderStyle(new Style(foreground: Color.Grey))
|
||||
.Header("Unix path"));
|
||||
|
||||
console.Write(
|
||||
new Panel(
|
||||
new Padder(new TextPath("/This/Is/A/Long/Path/That/Will/Be/Truncated.txt")
|
||||
.RootColor(Color.Green)
|
||||
.SeparatorColor(Color.Red)
|
||||
.StemColor(Color.Yellow)
|
||||
.LeafColor(Color.Blue), new Padding(0,1)))
|
||||
.BorderStyle(new Style(foreground: Color.Grey))
|
||||
.Header("Styling"));
|
||||
|
||||
console.Write(
|
||||
new Panel(
|
||||
new Padder(new Rows(
|
||||
new TextPath("/This/Is/A/Long/Path/That/Will/Be/Truncated.txt").LeftAligned(),
|
||||
new TextPath("/This/Is/A/Long/Path/That/Will/Be/Truncated.txt").Centered(),
|
||||
new TextPath("/This/Is/A/Long/Path/That/Will/Be/Truncated.txt").RightAligned()), new Padding(0,1)))
|
||||
.BorderStyle(new Style(foreground: Color.Grey))
|
||||
.Header("Alignment"));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user