mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-12-29 17:28:06 +01:00
Improve text composite
- A `Text` object should not be able to justify itself. All justification needs to be done by a parent. - Apply colors and styles to part of a `Text` object - Markup parser should return a `Text` object
This commit is contained in:
committed by
Patrik Svensson
parent
8e4f33bba4
commit
f19202b427
@@ -53,9 +53,10 @@ namespace Sample
|
||||
AnsiConsole.Foreground = Color.Maroon;
|
||||
AnsiConsole.Render(new Panel(new Panel(new Panel(new Panel(
|
||||
Text.New(
|
||||
"I heard you like 📦\n\n\n\nSo I put a 📦 in a 📦",
|
||||
foreground: Color.White,
|
||||
justify: Justify.Center))))));
|
||||
"[underline]I[/] heard [underline on blue]you[/] like 📦\n\n\n\n" +
|
||||
"So I put a 📦 in a 📦\nin a 📦 in a 📦\n\n" +
|
||||
"😅",
|
||||
foreground: Color.White), content: Justify.Center)))));
|
||||
|
||||
// Reset colors
|
||||
AnsiConsole.ResetColors();
|
||||
@@ -69,16 +70,14 @@ namespace Sample
|
||||
// Centered panel with text
|
||||
AnsiConsole.Render(new Panel(
|
||||
Text.New("Centered\nCenter",
|
||||
foreground: Color.White,
|
||||
justify: Justify.Center),
|
||||
fit: true));
|
||||
foreground: Color.White),
|
||||
fit: true, content: Justify.Center));
|
||||
|
||||
// Right adjusted panel with text
|
||||
AnsiConsole.Render(new Panel(
|
||||
Text.New("Right adjusted\nRight",
|
||||
foreground: Color.White,
|
||||
justify: Justify.Right),
|
||||
fit: true));
|
||||
foreground: Color.White),
|
||||
fit: true, content: Justify.Right));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user