Skip to main content

Class Ansi

Class to store the Ansi codes required for styling, all of the properties return System.String.Empty if Log73.Log73Options.UseAnsi is false. Mostly derived from https://en.wikipedia.org/wiki/ANSI_escape_code.

Assembly: Log73.dll
View Source
Declaration
public static class Ansi

Properties

Normal

Disable all ANSI effects.

View Source
Declaration
public static string Normal { get; }

Bold

View Source
Declaration
public static string Bold { get; }

BoldOff

View Source
Declaration
public static string BoldOff { get; }

NormalColor

View Source
Declaration
public static string NormalColor { get; }

Faint

View Source
Declaration
public static string Faint { get; }

Underline

View Source
Declaration
public static string Underline { get; }

UnderlineOff

View Source
Declaration
public static string UnderlineOff { get; }

Italic

View Source
Declaration
public static string Italic { get; }

NotItalic

View Source
Declaration
public static string NotItalic { get; }
View Source
Declaration
public static string SlowBlink { get; }
View Source
Declaration
public static string RapidBlink { get; }

BlinkOff

View Source
Declaration
public static string BlinkOff { get; }

Invert

View Source
Declaration
public static string Invert { get; }

InvertOff

View Source
Declaration
public static string InvertOff { get; }

CrossedOut

View Source
Declaration
public static string CrossedOut { get; }

CrossedOutOff

View Source
Declaration
public static string CrossedOutOff { get; }

DefaultForegroundColor

View Source
Declaration
public static string DefaultForegroundColor { get; }

DefaultBackgroundColor

View Source
Declaration
public static string DefaultBackgroundColor { get; }

Methods

ForegroundColor(String, Color)

Add ANSI foreground color to text.

View Source
Declaration
public static string ForegroundColor(string str, Color color)
Returns

System.String

Parameters
TypeName
System.Stringstr
System.Drawing.Colorcolor

BackgroundColor(String, Color)

Add ANSI background color to text.

View Source
Declaration
public static string BackgroundColor(string str, Color color)
Returns

System.String

Parameters
TypeName
System.Stringstr
System.Drawing.Colorcolor

ApplyColor(String, Nullable<Color>, Nullable<Color>)

View Source
Declaration
public static string ApplyColor(string str, Color? foregroundColor, Color? backgroundColor)
Returns

System.String

Parameters
TypeName
System.Stringstr
System.Nullable&lt;System.Drawing.Color&gt;foregroundColor
System.Nullable&lt;System.Drawing.Color&gt;backgroundColor

BestMatch(Color, IColorScheme)

View Source
Declaration
public static Color BestMatch(Color input, IColorScheme colorScheme)
Returns

System.Drawing.Color

Parameters
TypeName
System.Drawing.Colorinput
Log73.ColorSchemes.IColorSchemecolorScheme

ColorToConsoleColor(Color, IColorScheme)

View Source
Declaration
public static ConsoleColor ColorToConsoleColor(Color color, IColorScheme colorScheme)
Returns

System.ConsoleColor

Parameters
TypeName
System.Drawing.Colorcolor
Log73.ColorSchemes.IColorSchemecolorScheme