TextFormat Structure

Represents a virtual terminal (VT) sequence for a change in text formatting.

Definition

Namespace: Ookii.CommandLine.Terminal
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.2.0+a4d3631e4dcc0970081ed435288efdebc1325f83
C#
public readonly struct TextFormat : IEquatable<TextFormat>
Inheritance
Object    ValueType    TextFormat
Implements
IEquatableTextFormat

Remarks

Write one of the predefined values in this structure to a stream representing the console, such as Out or Error, to set the specified text format on that stream.

You should only write VT sequences to the console if they are supported. Use the EnableColor(StandardStream) method to check whether VT sequences are supported, and to enable them if required by the operating system.

You can combine TextFormat instances to apply multiple options by using the Combine(TextFormat) method or the Addition(TextFormat, TextFormat) operator.

Properties

Value Gets the text formatting string.

Methods

Combine Combines two text formatting values.
Equals(Object)Indicates whether this instance and a specified object are equal.
(Overrides ValueTypeEquals(Object))
Equals(TextFormat) Determine whether this instance and another TextFormat instance have the same value.
GetExtendedColor Returns a virtual terminal sequence that can be used to set the foreground or background color to an RGB color.
GetHashCodeReturns the hash code for this instance.
(Overrides ValueTypeGetHashCode)
GetTypeGets the Type of the current instance.
(Inherited from Object)
ToString Returns the text formatting string contained in this instance.
(Overrides ValueTypeToString)

Operators

Addition(TextFormat, TextFormat) Combines two text formatting values.
Equality(TextFormat, TextFormat) Determines whether this instance and another TextFormat instance have the same value.
Inequality(TextFormat, TextFormat) Determines whether this instance and another TextFormat instance have a different value.

Fields

BackgroundBlack Sets the background color to Black.
BackgroundBlue Sets the background color to Blue.
BackgroundCyan Sets the background color to Cyan.
BackgroundDefault Sets the background color to Default.
BackgroundGreen Sets the background color to Green.
BackgroundMagenta Sets the background color to Magenta.
BackgroundRed Sets the background color to Red.
BackgroundWhite Sets the background color to White.
BackgroundYellow Sets the background color to Yellow.
BoldBright Applies the brightness/intensity flag to the foreground color.
BrightBackgroundBlack Sets the background color to bright Black.
BrightBackgroundBlue Sets the background color to bright Blue.
BrightBackgroundCyan Sets the background color to bright Cyan.
BrightBackgroundGreen Sets the background color to bright Green.
BrightBackgroundMagenta Sets the background color to bright Magenta.
BrightBackgroundRed Sets the background color to bright Red.
BrightBackgroundWhite Sets the background color to bright White.
BrightBackgroundYellow Sets the background color to bright Yellow.
BrightForegroundBlack Sets the foreground color to bright Black.
BrightForegroundBlue Sets the foreground color to bright Blue.
BrightForegroundCyan Sets the foreground color to bright Cyan.
BrightForegroundGreen Sets the foreground color to bright Green.
BrightForegroundMagenta Sets the foreground color to bright Magenta.
BrightForegroundRed Sets the foreground color to bright Red.
BrightForegroundWhite Sets the foreground color to bright White.
BrightForegroundYellow Sets the foreground color to bright Yellow.
Default Resets the text format to the settings before modification.
ForegroundBlack Sets the foreground color to Black.
ForegroundBlue Sets the foreground color to Blue.
ForegroundCyan Sets the foreground color to Cyan.
ForegroundDefault Sets the foreground color to Default.
ForegroundGreen Sets the foreground color to Green.
ForegroundMagenta Sets the foreground color to Magenta.
ForegroundRed Sets the foreground color to Red.
ForegroundWhite Sets the foreground color to White.
ForegroundYellow Sets the foreground color to Yellow.
Negative Swaps the foreground and background colors.
NoBoldBright Removes the brightness/intensity flag from the foreground color.
NoUnderline Removes underlining from the text.
Positive Returns the foreground and background colors to their normal, non-swapped state.
Underline Adds underlining to the text.

Thread Safety

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.

See Also