Table of Contents

Struct Attribute

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Attributes are used as elements that contain both a foreground and a background or platform specific features.

public struct Attribute
Inherited Members

Remarks

Attributes are needed to map colors to terminal capabilities that might lack colors. They encode both the foreground and the background color and are used in the ColorScheme class to define color schemes that can be used in an application.

Constructors

Attribute(int)

Initializes a new instance of the Attribute struct with only the value passed to and trying to get the colors if defined.

Attribute(int, Color, Color)

Initializes a new instance of the Attribute struct.

Attribute(Color)

Initializes a new instance of the Attribute struct with the same colors for the foreground and background.

Attribute(Color, Color)

Initializes a new instance of the Attribute struct.

Properties

Background

The background color.

Foreground

The foreground color.

HasValidColors

Returns true if the Attribute is valid (both foreground and background have valid color values).

Initialized

If true the attribute has been initialized by a ConsoleDriver and thus has Value that is valid for that driver. If false the Foreground and Background colors may have been set '-1' but the attribute has not been mapped to a ConsoleDriver specific color value.

Value

The ConsoleDriver-specific color attribute value. If Initialized is false the value of this property is invalid (typically because the Attribute was created before a driver was loaded) and the attribute should be re-made (see Make(Color, Color)) before it is used.

Methods

Get()

Gets the current Attribute from the driver.

Make(Color, Color)

Creates an Attribute from the specified foreground and background colors.

Operators

implicit operator Attribute(int)

Implicitly convert an driver-specific color value into an Attribute

implicit operator int(Attribute)

Implicit conversion from an Attribute to the underlying, driver-specific, Int32 representation of the color.