module
Xssmaze::UI
Overview
Presentation tokens for everything XSSMaze prints to a terminal: colour
detection, the palette, and the brand mark. The palette is lifted straight
from the web UI (Assets::INDEX_CSS) so the CLI and the browser read as the
same product.
Defined in:
ui.crConstant Summary
-
BAD =
TRUE_COLOR ? "38;2;198;92;79" : "38;5;167" -
BOLD =
"1" -
DIM =
TRUE_COLOR ? "38;2;128;122;116" : "38;5;243" -
EMBER =
TRUE_COLOR ? "38;2;217;133;59" : "38;5;173" -
INERT =
TRUE_COLOR ? "38;2;127;143;154" : "38;5;109" -
LOG_FORMATTER =
::Log::Formatter.new do |entry, io| sgr = entry.severity >= ::Log::Severity::Error ? BAD : WARN (((io << " ") << (paint(entry.severity.label.downcase.ljust(5), sgr))) << " ") << entry.message if ex = entry.exception (io << '\n') << ex.inspect_with_backtrace end end -
Kemal's own log output (startup notice, unhandled exceptions). Dropping the ISO timestamp and the
kemal:source keeps rare messages readable instead of making every line look like a stack trace. -
MARK =
["┌─────────╴", "│ ┌─────┐", "│ │ └─┐ │", "│ │ ╵ │ │", "│ └───┘ │", "└───────┘"] -
The brand mark: the same square unicursal spiral as
Assets::FAVICON_SVG, redrawn on the 7x6 character grid the SVG path already snaps to. The stub at the top right is the exit; the one in the middle is where you start. -
MARK_WIDTH =
11 -
MUTED =
TRUE_COLOR ? "38;2;163;156;146" : "38;5;247" -
OK =
TRUE_COLOR ? "38;2;122;158;110" : "38;5;108" -
TRUE_COLOR =
{"truecolor", "24bit"}.includes?(ENV["COLORTERM"]?) -
Truecolor when the terminal advertises it, 256-colour otherwise. Both ladders track the dark-theme tokens, which is what a terminal usually is.
-
WARN =
TRUE_COLOR ? "38;2;217;164;59" : "38;5;179"
Class Method Summary
- .bold(text : String) : String
-
.color=(color : Bool)
Honour NO_COLOR (https://no-color.org) and stay plain when the output is piped into a file or a tool.
-
.color? : Bool
Honour NO_COLOR (https://no-color.org) and stay plain when the output is piped into a file or a tool.
- .dim(text : String) : String
- .ember(text : String) : String
- .muted(text : String) : String
- .paint(text : String, sgr : String) : String
Class Method Detail
Honour NO_COLOR (https://no-color.org) and stay plain when the output is
piped into a file or a tool. --no-color flips this off explicitly.
Honour NO_COLOR (https://no-color.org) and stay plain when the output is
piped into a file or a tool. --no-color flips this off explicitly.