Attribute

public struct Attribute

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

Attributes are needed to map colors to terminal capabilities that might lack colors, on color scenarios, they encode both the foreground and the background color. On black and white terminals, they encode attributes like “Bold”, “reverse”, “normal”, “blink”.

Attributes are used in the ColorScheme class to define color schemes that can be used in your application, and they are also used by views directly when they defined their own attributes.

  • Returns an attribute with the foreground element changed

    Declaration

    Swift

    public func change(foreground: Color) -> Attribute
  • Returns an attribute with the background element changed

    Declaration

    Swift

    public func change(background: Color) -> Attribute
  • Returns an attribute with the cell flags changed

    Declaration

    Swift

    public func change(flags: CellFlags) -> Attribute