Table of Contents

Struct Attribute

Namespace
Terminal.Gui.Drawing
Assembly
Terminal.Gui.dll

Represents the visual styling for a UI element, including foreground and background color and text style.

[JsonConverter(typeof(AttributeJsonConverter))]
public readonly record struct Attribute : IEqualityOperators<Attribute, Attribute, bool>, IEquatable<Attribute>
Implements
Inherited Members

Remarks

Attribute is a lightweight, immutable struct used to define how visual elements are rendered in a terminal UI. It wraps color and style information in a platform-independent way and is used extensively in Scheme, VisualRole, and theming infrastructure.

Constructors

Attribute()

Initializes a new instance of the Attribute struct with default values.

Attribute(in string, in string, in string?)

Initializes a new instance of the Attribute struct from string representations of colors and style.

Attribute(in string, in string, in TextStyle)

Initializes a new instance of the Attribute struct from string representations of colors and style.

Attribute(in Attribute)

Initializes a new Attribute from an existing instance, preserving explicit state.

Attribute(in Color)

Initializes an instance using a single color for both foreground and background.

Attribute(in Color, in Color)

Initializes an instance using two named colors.

Attribute(in Color, in Color, in TextStyle)

Initializes a new instance with foreground, background, and TextStyle.

Attribute(in Color, in ColorName16)

Initializes a new instance with foreground and background colors.

Attribute(in Color, in StandardColor)

Initializes a new instance with foreground and background colors.

Attribute(in ColorName16, in Color)

Initializes a new instance with foreground and background colors.

Attribute(in ColorName16, in ColorName16)

Initializes a new instance with foreground and background colors.

Attribute(in StandardColor, in Color)

Initializes a new instance with foreground and background colors.

Attribute(in StandardColor, in StandardColor)

Initializes a new instance with foreground and background colors.

Attribute(in StandardColor, in StandardColor, in TextStyle)

Initializes a new instance with foreground and background colors and a TextStyle.

Properties

Background

Gets the background Color used behind text.

Default

Default empty attribute.

Foreground

Gets the foreground Color used to render text.

Style

Gets the TextStyle (e.g., bold, underline, italic) applied to text.

Methods

Equals(Attribute)

Indicates whether the current object is equal to another object of the same type.

GetHashCode()

Returns the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

See Also