loom & weft
Made for Swift.

Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.

LOOM Unreleased (PR #2) / RENDERING AND LAYOUT

Style

Terminal colors and bold, dim, italic, underline, strike, reverse, hidden, blink, and underline-color attributes. Concrete defaults disable attributes and use terminal colors. StylePatch supports inheritance and explicit reset. Display depends on terminal and font support.

Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.

Example

let style = Style(foreground: .rgb(237, 166, 98), bold: true)
_ = Paragraph(TextLayout("Hello", width: 20), style: style)
Members on this page

Feature guides and release status

Style

Structure
struct Style

Conforms to: Swift.Equatable, Swift.Sendable, Swift.SendableMetatype.

The visual attributes applied to a terminal cell.

Source · Style.swift:37

foreground

Instance Property
var foreground: Color

Foreground text color.

Source · Style.swift:38

background

Instance Property
var background: Color

Background cell color.

Source · Style.swift:39

bold

Instance Property
var bold: Bool

Enables bold text.

Source · Style.swift:40

italic

Instance Property
var italic: Bool

Enables italic text.

Source · Style.swift:41

underlined

Instance Property
var underlined: Bool

Enables underline.

Source · Style.swift:42

reversed

Instance Property
var reversed: Bool

Enables reverse video.

Source · Style.swift:43

dim

Instance Property
var dim: Bool

A public field of this type. Its value type and mutability are shown in the declaration.

Source · Style.swift:44

strikethrough

Instance Property
var strikethrough: Bool

A public field of this type. Its value type and mutability are shown in the declaration.

Source · Style.swift:45

underlineColor

Instance Property
var underlineColor: Color

A public field of this type. Its value type and mutability are shown in the declaration.

Source · Style.swift:46

hidden

Instance Property
var hidden: Bool

A public field of this type. Its value type and mutability are shown in the declaration.

Source · Style.swift:47

applying(_:)

Instance Method
func applying(_ patch: StylePatch) -> Style

Resolves a patch over this appearance.

Unspecified attributes retain their current values.

Parameters (1)
patch
Argument type and any default are shown in the declaration; see the behavior notes above.

Returns Style.

Source · Style.swift:72