struct

Obsctl::CLI::Palette

Inherits Struct < Value < Object

Resolved ANSI palette for human-readable CLI output.

Formatters interpolate these unconditionally; when color is disabled every accessor returns an empty string, so a single code path produces both the decorated terminal form and the plain form used for pipes, files, and golden fixtures.

Constants

BLUE = "\e[34m"
BOLD = "\e[1m"
BRIGHT_WHITE = "\e[97m"
CYAN = "\e[36m"
DIM = "\e[2m"
GREEN = "\e[32m"
MAGENTA = "\e[35m"
RED = "\e[31m"
RESET = "\e[0m"
YELLOW = "\e[33m"

Constructors

colored

Palette that always emits escape sequences.

Source
monochrome

Palette that never emits escape sequences.

Source
new(enabled : Bool = false)
Source
resolve(mode : ColorMode, io : IO, env = ENV) : self

Resolves the palette for one invocation.

Auto colors only a real terminal, and defers to NO_COLOR and TERM=dumb so redirected output and dumb terminals stay plain.

Source

Instance methods

blue

Returns the blue escape sequence, or "" when color is disabled.

Source
bold

Returns the bold escape sequence, or "" when color is disabled.

Source
bright_white

Returns the bright_white escape sequence, or "" when color is disabled.

Source
cyan

Returns the cyan escape sequence, or "" when color is disabled.

Source
dim

Returns the dim escape sequence, or "" when color is disabled.

Source
enabled?
Source
green

Returns the green escape sequence, or "" when color is disabled.

Source
magenta

Returns the magenta escape sequence, or "" when color is disabled.

Source
red

Returns the red escape sequence, or "" when color is disabled.

Source
reset

Returns the reset escape sequence, or "" when color is disabled.

Source
yellow

Returns the yellow escape sequence, or "" when color is disabled.

Source