loom & weft
Made for Swift.

Published release 0.2.1. Unreleased PR #2 reference.

LOOM 0.2.1 / SUPPORTING WEFT TYPES

TerminalColorDepth

Output encodings: monochrome, 16-color ANSI, 256-color indexed, and 24-bit RGB. This type lives in weft and is not a loom typealias. Add the weft product and import weft when referring to its type name explicitly.

Defined by weft, with no loom typealias. Add the weft product to your target and use import weft when referring to this type by name.

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 depth: TerminalColorDepth = .ansi256
_ = Terminal(backend: ANSIBackend(), width: 80, height: 24, colorDepth: depth)
Members on this page

Feature guides and release status

TerminalColorDepth

Enumeration
enum TerminalColorDepth

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

The color encodings a terminal is expected to understand.

Source · TerminalCapabilities.swift:4

init(rawValue:)

Initializer
init?(rawValue: String)

Creates a color depth from its raw string: monochrome, ansi16, ansi256, or trueColor. Returns nil for an unrecognized string.

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

monochrome

Case
case monochrome

Emit text attributes while omitting foreground/background color sequences.

Source · TerminalCapabilities.swift:5

ansi16

Case
case ansi16

Use the basic/bright 16-color ANSI palette.

Source · TerminalCapabilities.swift:6

ansi256

Case
case ansi256

Use 256 indexed palette colors; RGB values are mapped to the nearest palette color.

Source · TerminalCapabilities.swift:7

trueColor

Case
case trueColor

Use explicit 24-bit red/green/blue color sequences.

Source · TerminalCapabilities.swift:8