« Spectre.Console » : différence entre les versions
De Banane Atomic
Aller à la navigationAller à la recherche
(→Markup) |
(→Markup) |
||
(5 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 2 : | Ligne 2 : | ||
= Links = | = Links = | ||
* [https://spectreconsole.net Spectre.Console] | * [https://spectreconsole.net Spectre.Console] | ||
* [https://spectreconsole.net/appendix/colors Colors] | |||
= [https://spectreconsole.net/markup Markup] = | = [https://spectreconsole.net/markup Markup] = | ||
Ligne 7 : | Ligne 8 : | ||
AnsiConsole.MarkupLine("[green]One[/] [underline green]Two[/] [bold green]Three[/]"); | AnsiConsole.MarkupLine("[green]One[/] [underline green]Two[/] [bold green]Three[/]"); | ||
// background | // background | ||
AnsiConsole. | AnsiConsole.MarkupLine("[default on blue]One[/] [bold yellow on blue]Two[/]"); | ||
var message = "One"; | var message = "One"; | ||
AnsiConsole. | AnsiConsole.MarkupLineInterpolated($"[red]{message}[/]"); | ||
</kode> | |||
= [https://spectreconsole.net/prompts/text Text prompt] = | |||
<kode lang='cs'> | |||
if (!AnsiConsole.Confirm("Do you want to continue?")) // Do you want to continue? [y/n] (y): _ | |||
if (!AnsiConsole.Confirm("Do you want to quit?", false)) // Do you want to quit? [y/n] (n): _ | |||
var password = AnsiConsole.Prompt( | |||
new TextPrompt<string>("Enter password: ") | |||
.PromptStyle("blue") | |||
.Secret()); | |||
</kode> | </kode> | ||
Dernière version du 27 août 2023 à 21:03
Links
Markup
AnsiConsole.MarkupLine("[green]One[/] [underline green]Two[/] [bold green]Three[/]"); // background AnsiConsole.MarkupLine("[default on blue]One[/] [bold yellow on blue]Two[/]"); var message = "One"; AnsiConsole.MarkupLineInterpolated($"[red]{message}[/]"); |
Text prompt
if (!AnsiConsole.Confirm("Do you want to continue?")) // Do you want to continue? [y/n] (y): _ if (!AnsiConsole.Confirm("Do you want to quit?", false)) // Do you want to quit? [y/n] (n): _ var password = AnsiConsole.Prompt( new TextPrompt<string>("Enter password: ") .PromptStyle("blue") .Secret()); |
Installation
dotnet add package Spectre.Console |