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

Closes #85 * Split Border into BoxBorder and TableBorder * Change how different table parts are composed * Add markdown table border
41 lines
1.6 KiB
C#
41 lines
1.6 KiB
C#
using System;
|
|
|
|
namespace Spectre.Console.Rendering
|
|
{
|
|
/// <summary>
|
|
/// Represents a border with a heavy header.
|
|
/// </summary>
|
|
public sealed class HeavyHeadTableBorder : TableBorder
|
|
{
|
|
/// <inheritdoc/>
|
|
public override TableBorder? SafeBorder => TableBorder.Square;
|
|
|
|
/// <inheritdoc/>
|
|
protected override string GetBorderPart(TableBorderPart part)
|
|
{
|
|
return part switch
|
|
{
|
|
TableBorderPart.HeaderTopLeft => "┏",
|
|
TableBorderPart.HeaderTop => "━",
|
|
TableBorderPart.HeaderTopSeparator => "┳",
|
|
TableBorderPart.HeaderTopRight => "┓",
|
|
TableBorderPart.HeaderLeft => "┃",
|
|
TableBorderPart.HeaderSeparator => "┃",
|
|
TableBorderPart.HeaderRight => "┃",
|
|
TableBorderPart.HeaderBottomLeft => "┡",
|
|
TableBorderPart.HeaderBottom => "━",
|
|
TableBorderPart.HeaderBottomSeparator => "╇",
|
|
TableBorderPart.HeaderBottomRight => "┩",
|
|
TableBorderPart.CellLeft => "│",
|
|
TableBorderPart.CellSeparator => "│",
|
|
TableBorderPart.CellRight => "│",
|
|
TableBorderPart.FooterBottomLeft => "└",
|
|
TableBorderPart.FooterBottom => "─",
|
|
TableBorderPart.FooterBottomSeparator => "┴",
|
|
TableBorderPart.FooterBottomRight => "┘",
|
|
_ => throw new InvalidOperationException("Unknown border part."),
|
|
};
|
|
}
|
|
}
|
|
}
|