namespace BytecodeApi.ConsoleUI;
///
/// Represents a style for console text.
///
public sealed class ConsoleStyle
{
///
/// Gets or sets the text color.
///
public ConsoleColor Foreground { get; set; }
///
/// Gets or sets the background color.
///
public ConsoleColor Background { get; set; }
///
/// Initializes a new instance of the class.
///
public ConsoleStyle() : this(ConsoleColor.Gray)
{
}
///
/// Initializes a new instance of the class.
///
/// The text color.
public ConsoleStyle(ConsoleColor foreground) : this(foreground, ConsoleColor.Black)
{
}
///
/// Initializes a new instance of the class.
///
/// The text color.
/// The background color.
public ConsoleStyle(ConsoleColor foreground, ConsoleColor background)
{
Foreground = foreground;
Background = background;
}
internal void Write(string value)
{
Do(() => Console.Write(value));
}
internal void WriteLine(string value)
{
Write(value);
Console.WriteLine();
}
internal string ReadLine()
{
return Do(() => Console.ReadLine() ?? "");
}
private void Do(Action action)
{
Do