spectre.console/src/Spectre.Console/Extensions/FigletTextExtensions.cs
Patrik Svensson a59e0dcb21 Add FIGlet text support
Closes #97
2020-11-22 03:09:42 +01:00

28 lines
783 B
C#

using System;
namespace Spectre.Console
{
/// <summary>
/// Contains extension methods for <see cref="FigletText"/>.
/// </summary>
public static class FigletTextExtensions
{
/// <summary>
/// Sets the color of the FIGlet text.
/// </summary>
/// <param name="text">The text.</param>
/// <param name="color">The color.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static FigletText Color(this FigletText text, Color? color)
{
if (text is null)
{
throw new ArgumentNullException(nameof(text));
}
text.Color = color ?? Console.Color.Default;
return text;
}
}
}