iox/ANSIColor.cs
/// <summary>
/// Convert the ANSI color to an ANSI-escape string.
/// </summary>
/// <returns>The ANSI-escaped string.</returns>
/// <param name="foreground">If set to <c>true</c> foreground.</param>
Convert the ANSI color to an ANSI-escape string.
Convert the ANSI color to an ANSI - escape string .
string ToAnsiString (bool foreground) {
			bool bright = Bright;
			string colorString = $"{ANSI.ESC}[{(foreground ? 3 : 4)}{(int) BaseColor}m";
			if (FromConsoleColor) {
				var baseColor = (int) (foreground ? FromConsoleFG : FromConsoleBG);
				bright = baseColor >= 8;
				colorString = $"{ANSI.ESC}[{(foreground ? 3 : 4)}{(bright ? baseColor - 8 : baseColor)}m";
			}
			if (!Bright) return colorString;
			return $"{ANSI.ESC}[1m{colorString}{ANSI.ESC}[22m";
		}
string ToAnsiString ( bool foreground ) { bool bright = Bright ; string colorString = $" { ANSI . ESC } [ { ( foreground ? 3 : 4 ) } { ( int ) BaseColor } m " ; if ( FromConsoleColor ) { var baseColor = ( int ) ( foreground ? FromConsoleFG : FromConsoleBG ) ; bright = baseColor >= 8 ; colorString = $" { ANSI . ESC } [ { ( foreground ? 3 : 4 ) } { ( bright ? baseColor - 8 : baseColor ) } m " ; } if ( ! Bright ) return colorString ; return $" { ANSI . ESC } [1m { colorString } { ANSI . ESC } [22m " ; }
Convert the ANSI color to an ANSI-escape string.
Convert the ANSI color to an ANSI - escape string .
The ANSI-escaped string.
The ANSI - escaped string .
foreground
bool
If set to true
If set to true