« Spectre.Console » : différence entre les versions

De Banane Atomic
Aller à la navigationAller à la recherche
 
(Une version intermédiaire par le même utilisateur non affichée)
Ligne 8 : 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.Markup("[default on blue]One[/] [bold yellow on blue]Two[/]");
AnsiConsole.MarkupLine("[default on blue]One[/] [bold yellow on blue]Two[/]");


var message = "One";
var message = "One";
AnsiConsole.MarkupInterpolated($"[red]{message}[/]");
AnsiConsole.MarkupLineInterpolated($"[red]{message}[/]");
</kode>
</kode>


Ligne 18 : Ligne 18 :
if (!AnsiConsole.Confirm("Do you want to continue?")) // Do you want to continue? [y/n] (y): _
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): _
if (!AnsiConsole.Confirm("Do you want to quit?", false))  // Do you want to quit? [y/n] (n): _
</kode>


<kode lang='cs'>
var password = AnsiConsole.Prompt(
var password = AnsiConsole.Prompt(
     new TextPrompt<string>("Enter password: ")
     new TextPrompt<string>("Enter password: ")

Dernière version du 27 août 2023 à 21:03

Links

Markup

Cs.svg
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

Cs.svg
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

Bash.svg
dotnet add package Spectre.Console