mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 08:52:50 +08:00

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.
29 lines
945 B
C#
29 lines
945 B
C#
using Spectre.Console;
|
|
|
|
namespace InfoExample
|
|
{
|
|
public static class Program
|
|
{
|
|
public static void Main()
|
|
{
|
|
var grid = new Grid()
|
|
.AddColumn(new GridColumn().NoWrap().PadRight(4))
|
|
.AddColumn()
|
|
.AddRow("[b]Color system[/]", $"{AnsiConsole.Capabilities.ColorSystem}")
|
|
.AddRow("[b]Supports ansi?[/]", $"{YesNo(AnsiConsole.Capabilities.SupportsAnsi)}")
|
|
.AddRow("[b]Legacy console?[/]", $"{YesNo(AnsiConsole.Capabilities.LegacyConsole)}")
|
|
.AddRow("[b]Buffer width[/]", $"{AnsiConsole.Console.Width}")
|
|
.AddRow("[b]Buffer height[/]", $"{AnsiConsole.Console.Height}");
|
|
|
|
AnsiConsole.Render(
|
|
new Panel(grid)
|
|
.Header("Information"));
|
|
}
|
|
|
|
private static string YesNo(bool value)
|
|
{
|
|
return value ? "Yes" : "No";
|
|
}
|
|
}
|
|
}
|