AnsiConsole Class

A console capable of writing ANSI escape sequences.
public static class AnsiConsole
Namespace
Spectre.Console

Properties

static Color Background
Gets or sets the background color.
static IAnsiConsole Console
Gets or sets the underlying IAnsiConsole.
static IAnsiConsoleCursor Cursor
Gets the IAnsiConsoleCursor.
static Decoration Decoration
Gets or sets the text decoration.
static Color Foreground
Gets or sets the foreground color.
static Profile Profile
Gets the console profile.

Methods

static void AlternateScreen(Action)
Switches to an alternate screen buffer if the terminal supports it.
static T Ask<T>(string, T)
Displays a prompt to the user with a given default.
static T Ask<T>(string)
Displays a prompt to the user.
static Task<T> AskAsync<T>(string, CancellationToken)
Displays a prompt to the user.
static Task<T> AskAsync<T>(string, T, CancellationToken)
Displays a prompt to the user with a given default.
static void Clear()
Clears the console.
static bool Confirm(string, bool)
Displays a prompt with two choices, yes or no.
static Task<bool> ConfirmAsync(string, bool, CancellationToken)
Displays a prompt with two choices, yes or no.
static IAnsiConsole Create(AnsiConsoleSettings)
Creates a new IAnsiConsole instance from the provided settings.
static string ExportCustom(IAnsiConsoleEncoder)
Exports all recorded console output using a custom encoder.
static string ExportHtml()
Exports all recorded console output as HTML text.
static string ExportText()
Exports all recorded console output as text.
static LiveDisplay Live(IRenderable)
Creates a new LiveDisplay instance.
static void Markup(IFormatProvider, string, object[])
Writes the specified markup to the console.
static void Markup(string, object[])
Writes the specified markup to the console.
static void Markup(string)
Writes the specified markup to the console.
static void MarkupInterpolated(FormattableString)
Writes the specified markup to the console.

All interpolation holes which contain a string are automatically escaped so you must not call EscapeMarkup(string).

static void MarkupInterpolated(IFormatProvider, FormattableString)
Writes the specified markup to the console.

All interpolation holes which contain a string are automatically escaped so you must not call EscapeMarkup(string).

static void MarkupLine(IFormatProvider, string, object[])
Writes the specified markup, followed by the current line terminator, to the console.
static void MarkupLine(string, object[])
Writes the specified markup, followed by the current line terminator, to the console.
static void MarkupLine(string)
Writes the specified markup, followed by the current line terminator, to the console.
static void MarkupLineInterpolated(FormattableString)
Writes the specified markup, followed by the current line terminator, to the console.

All interpolation holes which contain a string are automatically escaped so you must not call EscapeMarkup(string).

static void MarkupLineInterpolated(IFormatProvider, FormattableString)
Writes the specified markup, followed by the current line terminator, to the console.

All interpolation holes which contain a string are automatically escaped so you must not call EscapeMarkup(string).

static Progress Progress()
Creates a new Progress() instance.
static T Prompt<T>(IPrompt<T>)
Displays a prompt to the user.
static Task<T> PromptAsync<T>(IPrompt<T>, CancellationToken)
Displays a prompt to the user.
static void Record()
Starts recording the console output.
static void Render(IRenderable)
Renders the specified object to the console.
static void Reset()
Resets colors and text decorations.
static void ResetColors()
Resets the current applied foreground and background colors.
static void ResetDecoration()
Resets the current applied text decorations.
static Status Status()
Creates a new Status() instance.
static void Write(bool)
Writes the text representation of the specified boolean value to the console.
static void Write(char)
Writes the specified Unicode character to the console.
static void Write(char[])
Writes the specified array of Unicode characters to the console.
static void Write(decimal)
Writes the text representation of the specified decimal value, to the console.
static void Write(double)
Writes the text representation of the specified double-precision floating-point value to the console.
static void Write(float)
Writes the text representation of the specified single-precision floating-point value to the console.
static void Write(IFormatProvider, bool)
Writes the text representation of the specified boolean value to the console.
static void Write(IFormatProvider, char)
Writes the specified Unicode character to the console.
static void Write(IFormatProvider, char[])
Writes the specified array of Unicode characters to the console.
static void Write(IFormatProvider, decimal)
Writes the text representation of the specified decimal value, to the console.
static void Write(IFormatProvider, double)
Writes the text representation of the specified double-precision floating-point value to the console.
static void Write(IFormatProvider, float)
Writes the text representation of the specified single-precision floating-point value to the console.
static void Write(IFormatProvider, int)
Writes the text representation of the specified 32-bit signed integer value to the console.
static void Write(IFormatProvider, long)
Writes the text representation of the specified 64-bit signed integer value to the console.
static void Write(IFormatProvider, string, object[])
Writes the text representation of the specified array of objects, to the console using the specified format information.
static void Write(IFormatProvider, uint)
Writes the text representation of the specified 32-bit unsigned integer value to the console.
static void Write(IFormatProvider, ulong)
Writes the text representation of the specified 64-bit unsigned integer value to the console.
static void Write(int)
Writes the text representation of the specified 32-bit signed integer value to the console.
static void Write(IRenderable)
Renders the specified IRenderable to the console.
static void Write(long)
Writes the text representation of the specified 64-bit signed integer value to the console.
static void Write(string, object[])
Writes the text representation of the specified array of objects, to the console using the specified format information.
static void Write(string)
Writes the specified string value to the console.
static void Write(uint)
Writes the text representation of the specified 32-bit unsigned integer value to the console.
static void Write(ulong)
Writes the text representation of the specified 64-bit unsigned integer value to the console.
static void WriteException(Exception, ExceptionFormats)
Writes an exception to the console.
static void WriteException(Exception, ExceptionSettings)
Writes an exception to the console.
static void WriteLine()
Writes an empty line to the console.
static void WriteLine(bool)
Writes the text representation of the specified boolean value, followed by the current line terminator, to the console.
static void WriteLine(char)
Writes the specified Unicode character, followed by the current line terminator, value to the console.
static void WriteLine(char[])
Writes the specified array of Unicode characters, followed by the current line terminator, value to the console.
static void WriteLine(decimal)
Writes the text representation of the specified decimal value, followed by the current line terminator, to the console.
static void WriteLine(double)
Writes the text representation of the specified double-precision floating-point value, followed by the current line terminator, to the console.
static void WriteLine(float)
Writes the text representation of the specified single-precision floating-point value, followed by the current line terminator, to the console.
static void WriteLine(IFormatProvider, bool)
Writes the text representation of the specified boolean value, followed by the current line terminator, to the console.
static void WriteLine(IFormatProvider, char)
Writes the specified Unicode character, followed by the current line terminator, value to the console.
static void WriteLine(IFormatProvider, char[])
Writes the specified array of Unicode characters, followed by the current line terminator, value to the console.
static void WriteLine(IFormatProvider, decimal)
Writes the text representation of the specified decimal value, followed by the current line terminator, to the console.
static void WriteLine(IFormatProvider, double)
Writes the text representation of the specified double-precision floating-point value, followed by the current line terminator, to the console.
static void WriteLine(IFormatProvider, float)
Writes the text representation of the specified single-precision floating-point value, followed by the current line terminator, to the console.
static void WriteLine(IFormatProvider, int)
Writes the text representation of the specified 32-bit signed integer value, followed by the current line terminator, to the console.
static void WriteLine(IFormatProvider, long)
Writes the text representation of the specified 64-bit signed integer value, followed by the current line terminator, to the console.
static void WriteLine(IFormatProvider, string, object[])
Writes the text representation of the specified array of objects, followed by the current line terminator, to the console using the specified format information.
static void WriteLine(IFormatProvider, uint)
Writes the text representation of the specified 32-bit unsigned integer value, followed by the current line terminator, to the console.
static void WriteLine(IFormatProvider, ulong)
Writes the text representation of the specified 64-bit unsigned integer value, followed by the current line terminator, to the console.
static void WriteLine(int)
Writes the text representation of the specified 32-bit signed integer value, followed by the current line terminator, to the console.
static void WriteLine(long)
Writes the text representation of the specified 64-bit signed integer value, followed by the current line terminator, to the console.
static void WriteLine(string, object[])
Writes the text representation of the specified array of objects, followed by the current line terminator, to the console using the specified format information.
static void WriteLine(string)
Writes the specified string value, followed by the current line terminator, to the console.
static void WriteLine(uint)
Writes the text representation of the specified 32-bit unsigned integer value, followed by the current line terminator, to the console.
static void WriteLine(ulong)
Writes the text representation of the specified 64-bit unsigned integer value, followed by the current line terminator, to the console.