// console_ui palette — the one place an ANSI color is spelled. // // Every entry is an SGR escape when `color` is on and an empty string when it // is off, so call sites stay branch-free: an uncolored build emits nothing // extra and a fixed-string contract grep matches the same bytes either way. // The status tags (tags.flash) and every future panel / key-value / progress // renderer tint from here — never inline a raw escape at a call site. // // Only a subset is wired today; the rest are seeded so a new renderer can reach // for a color without widening this block. `pub` is deliberate: it exposes the // palette to consumers and keeps an as-yet-unreferenced entry from tripping // Zig's unused-constant error. /// Master ANSI switch. With color off every entry below is "", so a tag /// renders as its plain six-wide `[ OK ]` / `[FAIL]` form and the byte stream /// is escape-free. A fixed-string contract grep that expects a bare `[FAIL]` /// must therefore run against a color-off build; color on tints only the inner /// word and leaves the brackets in the default color. pub const color bool = true /// Charset knob for the box-drawing renderers (console_ui.screen panels). /// false = ASCII (+-|), true = Unicode lines. The device console passes raw /// bytes; only UTF-8 terminals render the Unicode forms, so ASCII is the safe /// default. Single source — console_ui re-exports this as console_ui.unicode. pub const unicode bool = false const esc = "\x1b[" // foreground — the eight base ANSI colors (yellow is the amber the // [LOAD] / [WARN] tags use). pub const black = if (color) esc ++ "30m" else "" pub const red = if (color) esc ++ "31m" else "" pub const green = if (color) esc ++ "32m" else "" pub const yellow = if (color) esc ++ "33m" else "" pub const blue = if (color) esc ++ "34m" else "" pub const magenta = if (color) esc ++ "35m" else "" pub const cyan = if (color) esc ++ "36m" else "" pub const white = if (color) esc ++ "37m" else "" // bright / high-intensity set (bright_black = grey, the usual dim-text color). pub const bright_black = if (color) esc ++ "90m" else "" pub const bright_red = if (color) esc ++ "91m" else "" pub const bright_green = if (color) esc ++ "92m" else "" pub const bright_yellow = if (color) esc ++ "93m" else "" pub const grey = bright_black // attributes pub const bold = if (color) esc ++ "1m" else "" pub const dim = if (color) esc ++ "2m" else "" pub const reset = if (color) esc ++ "0m" else ""