Skip to content

fix(cliamp hook): readable accent + correct fg/bright_fg brightness - #3

Merged
OldJobobo merged 1 commit into
OldJobobo:thpmfrom
HANCORE-linux:fix/cliamp-theme-color-mapping
Jun 15, 2026
Merged

fix(cliamp hook): readable accent + correct fg/bright_fg brightness#3
OldJobobo merged 1 commit into
OldJobobo:thpmfrom
HANCORE-linux:fix/cliamp-theme-color-mapping

Conversation

@HANCORE-linux

Copy link
Copy Markdown

Problem

The cliamp theme-set hook (theme-set.d/50-cliamp.sh) writes
~/.config/cliamp/themes/omarchy.toml with a verbatim mapping:

accent    = normal_blue    # color4
bright_fg = bright_white   # color15
fg        = normal_white   # color7

This breaks colours for some Omarchy themes, with the only workaround being
rm -rf ~/.config/cliamp/themes/. Two issues, measured on a matte/monochrome
theme (background #121212):

  1. accent = color4 is unreadable. cliamp uses accent for the title, the
    seek bar and the key-hint background. On monochrome palettes color4 is a
    dark colour (e.g. #605d5b, contrast 2.87:1 vs bg, below WCAG 3:1) →
    those elements become invisible.
  2. bright_fg/fg aren't ordered by brightness. cliamp uses bright_fg
    for normal text and fg for dimmed text, so bright_fg must be the brighter
    of the two. Some palettes define color15 darker than color7
    (#a4a4a4 vs #dbd9d3), so dimmed text ends up brighter than normal
    text → "wrong / too bright" colours.

(rm only "helps" because cliamp then can't find the theme, SetTheme returns
false, and cliamp falls back to its ANSI defaults.)

Fix

  • Pick bright_fg/fg from color7/color15 by luminance, so bright_fg
    is always the brighter one.
  • Keep accent = normal_blue when it has enough contrast against the
    background; otherwise fall back to the first readable, preferably coloured
    candidate (bright_blue, normal_cyan, normal_yellow, normal_green,
    normal_red), and only to the foreground colour as a last resort.

Pure integer luminance, no new dependencies. Verified on the affected theme:
accent #605d5b → #b7a798 (readable), bright_fg #a4a4a4 → #dbd9d3,
fg #dbd9d3 → #a4a4a4 (correct order).

Context: this was originally (mis)filed as a cliamp validation issue
(bjarneo/cliamp#260) — the user themes are complete and valid; the real fix is
here in the hook's colour mapping.

The cliamp theme-set hook mapped accent=color4 and bright_fg/fg=color15/color7
verbatim. On monochrome/matte palettes color4 is a dark, low-contrast colour,
yet cliamp uses accent for the title, seek bar and the key-hint background ->
those become unreadable. Some palettes also define color15 darker than color7,
which inverts cliamp's normal/dim text brightness.

Pick bright_fg/fg by luminance (bright_fg always the brighter), and fall back to
a readable, preferably coloured accent when color4 is too close to the bg.
@OldJobobo
OldJobobo merged commit fcad509 into OldJobobo:thpm Jun 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants