using System;
namespace Spectre.Console
{
///
/// Represents a title.
///
public sealed class Title : IAlignable
{
///
/// Gets the title text.
///
public string Text { get; }
///
/// Gets or sets the title style.
///
public Style? Style { get; set; }
///
/// Gets or sets the title alignment.
///
public Justify? Alignment { get; set; }
///
/// Initializes a new instance of the class.
///
/// The title text.
/// The title style.
/// The title alignment.
public Title(string text, Style? style = null, Justify? alignment = null)
{
Text = text ?? throw new ArgumentNullException(nameof(text));
Style = style;
Alignment = alignment;
}
///
/// Sets the title style.
///
/// The title style.
/// The same instance so that multiple calls can be chained.
public Title SetStyle(Style? style)
{
Style = style ?? Style.Plain;
return this;
}
///
/// Sets the title alignment.
///
/// The title alignment.
/// The same instance so that multiple calls can be chained.
public Title SetAlignment(Justify alignment)
{
Alignment = alignment;
return this;
}
}
}