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, VIEWPORTS, AND COMPOSITION

StylePatch

Optional appearance changes composed over a resolved Style.

Nil inherits the existing attribute. A false modifier explicitly disables it; .terminalDefault explicitly resets a color. Use Blink.none to disable blinking (nil or optional .none inherits it). For example, Style(foreground: .indexed(4)).applying(StylePatch(bold: true)) retains blue.

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

_ = Style(bold: true).applying(StylePatch(bold: false, italic: true))
Members on this page

Feature guides and release status

StylePatch

Structure
struct StylePatch

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

Optional appearance changes composed over a resolved Style.

Nil inherits the existing attribute. A false modifier explicitly disables it; .terminalDefault explicitly resets a color. Use Blink.none to disable blinking (nil or optional .none inherits it). For example, Style(foreground: .indexed(4)).applying(StylePatch(bold: true)) retains blue.

Source · StylePatch.swift:7

foreground

Instance Property
var foreground: Color?

Foreground text color.

Source · StylePatch.swift:8

background

Instance Property
var background: Color?

Background cell color.

Source · StylePatch.swift:9

bold

Instance Property
var bold: Bool?

Enables bold text.

Source · StylePatch.swift:10

italic

Instance Property
var italic: Bool?

Enables italic text.

Source · StylePatch.swift:11

underlined

Instance Property
var underlined: Bool?

Enables underline.

Source · StylePatch.swift:12

reversed

Instance Property
var reversed: Bool?

Enables reverse video.

Source · StylePatch.swift:13

dim

Instance Property
var dim: Bool?

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

Source · StylePatch.swift:14

strikethrough

Instance Property
var strikethrough: Bool?

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

Source · StylePatch.swift:15

underlineColor

Instance Property
var underlineColor: Color?

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

Source · StylePatch.swift:16

hidden

Instance Property
var hidden: Bool?

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

Source · StylePatch.swift:17

applying(_:)

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

Composes another patch after this one.

Its specified attributes take precedence.

Applying the result to a style is equivalent to applying the two patches in order.

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

Returns StylePatch.

Source · StylePatch.swift:44