Add panel header support

Closes #63
This commit is contained in:
Patrik Svensson
2020-09-03 18:48:30 +02:00
committed by Patrik Svensson
parent 9f8ca6d648
commit 7471e9d38c
11 changed files with 301 additions and 27 deletions

View File

@ -4,7 +4,7 @@ namespace ColorExample
{
public static class Program
{
public static void Main(string[] args)
public static void Main()
{
if (AnsiConsole.Capabilities.ColorSystem == ColorSystem.NoColors)
{

View File

@ -3,9 +3,9 @@ using Spectre.Console;
namespace Diagnostic
{
public class Program
public static class Program
{
public static void Main(string[] args)
public static void Main()
{
AnsiConsole.MarkupLine("Color system: [bold]{0}[/]", AnsiConsole.Capabilities.ColorSystem);
AnsiConsole.MarkupLine("Supports ansi? [bold]{0}[/]", AnsiConsole.Capabilities.SupportsAnsi);

View File

@ -2,9 +2,9 @@ using Spectre.Console;
namespace GridExample
{
public sealed class Program
public static class Program
{
static void Main(string[] args)
public static void Main()
{
AnsiConsole.WriteLine();
AnsiConsole.MarkupLine("Usage: [grey]dotnet [blue]run[/] [[options]] [[[[--]] <additional arguments>...]]]][/]");

View File

@ -2,9 +2,9 @@ using Spectre.Console;
namespace PanelExample
{
class Program
public static class Program
{
static void Main(string[] args)
public static void Main()
{
var content = new Markup(
"[underline]I[/] heard [underline on blue]you[/] like panels\n\n\n\n" +
@ -14,7 +14,7 @@ namespace PanelExample
new Panel(
new Panel(content)
{
Border = BorderKind.Rounded
Border = BorderKind.Rounded,
}));
// Left adjusted panel with text
@ -22,6 +22,7 @@ namespace PanelExample
new Text("Left adjusted\nLeft").LeftAligned())
{
Expand = true,
Header = new Header("Left", new Style(foreground: Color.Red)).LeftAligned(),
});
// Centered ASCII panel with text
@ -30,6 +31,7 @@ namespace PanelExample
{
Expand = true,
Border = BorderKind.Ascii,
Header = new Header("Center", new Style(foreground: Color.Green)).Centered(),
});
// Right adjusted, rounded panel with text
@ -38,6 +40,7 @@ namespace PanelExample
{
Expand = true,
Border = BorderKind.Rounded,
Header = new Header("Right", new Style(foreground: Color.Blue)).RightAligned(),
});
}
}

View File

@ -5,7 +5,7 @@ namespace TableExample
{
public static class Program
{
public static void Main(string[] args)
public static void Main()
{
// A simple table
RenderSimpleTable();