struct
Obsctl::CLI::Palette
- Obsctl::CLI::Palette
- Struct
- Value
- Object
Overview
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.
Defined in:
obsctl/cli/color.crConstant Summary
-
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 : self
Palette that always emits escape sequences.
-
.monochrome : self
Palette that never emits escape sequences.
- .new(enabled : Bool = false)
-
.resolve(mode : ColorMode, io : IO, env = ENV) : self
Resolves the palette for one invocation.
Instance Method Summary
-
#blue : String
Returns the blue escape sequence, or "" when color is disabled.
-
#bold : String
Returns the bold escape sequence, or "" when color is disabled.
-
#bright_white : String
Returns the bright_white escape sequence, or "" when color is disabled.
-
#cyan : String
Returns the cyan escape sequence, or "" when color is disabled.
-
#dim : String
Returns the dim escape sequence, or "" when color is disabled.
- #enabled? : Bool
-
#green : String
Returns the green escape sequence, or "" when color is disabled.
-
#magenta : String
Returns the magenta escape sequence, or "" when color is disabled.
-
#red : String
Returns the red escape sequence, or "" when color is disabled.
-
#reset : String
Returns the reset escape sequence, or "" when color is disabled.
-
#yellow : String
Returns the yellow escape sequence, or "" when color is disabled.
Constructor Detail
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.