mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-12-27 00:08:02 +01: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.
32 lines
942 B
C#
32 lines
942 B
C#
using System;
|
|
|
|
namespace Spectre.Console.Rendering
|
|
{
|
|
/// <summary>
|
|
/// Contains extension methods for <see cref="TableBorder"/>.
|
|
/// </summary>
|
|
public static class TableBorderExtensions
|
|
{
|
|
/// <summary>
|
|
/// Gets the safe border for a border.
|
|
/// </summary>
|
|
/// <param name="border">The border to get the safe border for.</param>
|
|
/// <param name="safe">Whether or not to return the safe border.</param>
|
|
/// <returns>The safe border if one exist, otherwise the original border.</returns>
|
|
public static TableBorder GetSafeBorder(this TableBorder border, bool safe)
|
|
{
|
|
if (border is null)
|
|
{
|
|
throw new ArgumentNullException(nameof(border));
|
|
}
|
|
|
|
if (safe && border.SafeBorder != null)
|
|
{
|
|
border = border.SafeBorder;
|
|
}
|
|
|
|
return border;
|
|
}
|
|
}
|
|
}
|