using System;
using Spectre.Console.Internal;
namespace Spectre.Console
{
///
/// A console capable of writing ANSI escape sequences.
///
public static partial class AnsiConsole
{
private static readonly Lazy _console = new Lazy(() =>
{
var console = Create(new AnsiConsoleSettings
{
Ansi = AnsiSupport.Detect,
ColorSystem = ColorSystemSupport.Detect,
Out = System.Console.Out,
});
Initialize(System.Console.Out);
Created = true;
return console;
});
///
/// Gets the underlying .
///
public static IAnsiConsole Console => _console.Value;
///
/// Gets the console's capabilities.
///
public static Capabilities Capabilities => Console.Capabilities;
///
/// Gets the buffer width of the console.
///
public static int Width
{
get => Console.Width;
}
///
/// Gets the buffer height of the console.
///
public static int Height
{
get => Console.Height;
}
///
/// Creates a new instance
/// from the provided settings.
///
/// The settings to use.
/// An instance.
public static IAnsiConsole Create(AnsiConsoleSettings settings)
{
return ConsoleBuilder.Build(settings);
}
}
}