Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
One updated test still hard-codes the old default fallback color in a later validation check, and chrome_seed derivation should avoid overriding an explicitly provided chrome_seed / avoid running on non-hex backgrounds.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adjusts Omarchy’s Chromium theming so BrowserThemeColor is treated as a seed (as Chromium does) rather than a paint color, preventing near-black / near-white tinted backgrounds from producing highly saturated chrome colors.
Changes:
- Add a background→
chrome_seedclamp inomarchy-theme-set-templatesand switchchromium.themegeneration to usechrome_seed_rgb. - Make the browser-policy fallback color neutral (
#1f1f1f) and update related shell tests. - Document the behavior in theming docs/manual and add a dedicated clamp test.
File summaries
| File | Description |
|---|---|
bin/omarchy-theme-set-templates |
Derives chrome_seed from background to avoid degenerate HSL saturation seeds at luminance extremes. |
default/themed/chromium.theme.tpl |
Uses chrome_seed_rgb instead of background_rgb for generated chromium.theme. |
install/helpers/browser-policy.sh |
Changes default policy color fallback to neutral #1f1f1f with rationale. |
test/shell.d/chrome-seed-test.sh |
Adds test coverage for the clamp behavior across representative backgrounds. |
test/shell.d/browser-policy-dir-test.sh |
Updates fallback expectations for malformed inputs (needs one more update; see comments). |
test/shell.d/browser-policy-sudoers-test.sh |
Updates fallback expectations for malformed inputs. |
docs/theming.md |
Documents that chromium.theme is generated from a clamped seed derived from background. |
manual/43-making-your-own-theme.md |
Explains the clamped chrome-seed behavior for theme authors. |
Review details
- Files reviewed: 7/8 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| for malformed in "" "not,a,color" "1,2" "1,2,3,4" "256,0,0" "999,999,999" "-1,0,0" \ | ||
| "1,2,3;id" '1,2,$(id)' "0x10,0,0" "1,2,3 4,5,6"; do | ||
| [[ $(browser_policy_theme_hex "$malformed") == "#1c2027" ]] || | ||
| [[ $(browser_policy_theme_hex "$malformed") == "#1f1f1f" ]] || |
quattro now renders every template in one awk pass (omacom#13406), so the chrome seed is computed in bash and returned through REPLY like the other helpers, and a non-hex background's {{ chrome_seed_rgb }} goes into the value table rather than the sed script that no longer exists. theme-set-browser-test.sh, new on quattro, pins the fallback color, so it follows the fallback to #1f1f1f. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1c2027 is not at a luminance extreme, so Chromium 152 does not saturate it: its toolbar renders blue-grey #39424f, not loud blue. The neutral fallback stays; the comment now says what it avoids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed at 1caa829, on a worker built from the Omarchy ISO, running Chromium 152. What I pushed. The branch had stopped merging into The bug is real, and the clamp fixes the reported cases. I set
Still open: colours just outside the clamp stay saturated. The condition only fires when
Chromium keeps the seed's HSL saturation, so the boundary that matches the cause is saturation itself, for example neutralising a low-chroma seed whose saturation is at least 0.5, as #7624 proposes. That changes which themes keep their tint, so it is for the author to choose. The fallback change is separate from the bug. Tests on the worker. Second opinion. Codex Medium reviewed it. It found the near-boundary gap above, which I then confirmed in Chromium. It found nothing else wrong in the parsing, the non-hex path or the docs. It also judged the fallback change unnecessary for this bug. Next. This waits on @1azza for the clamp boundary, and on the maintainer for the fallback colour and the classification. Once the boundary is settled, it would close #7624. |
|
| (( g < min )) && min=$g | ||
| (( b < min )) && min=$b | ||
|
|
||
| if (( (max == 255 || max + min <= 16) && max - min <= 32 )); then |
There was a problem hiding this comment.
Saturated seeds escape the clamp A near-black background such as
#000011 misses the cutoff because its maximum and minimum channels sum to 17. It remains fully saturated as a Chromium seed, so the browser can still show the conspicuous blue chrome this change aims to prevent. Near-white colors such as #fefdf0 also miss the max == 255 check.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| # derivation. A theme that defines its own chrome_seed keeps it; a | ||
| # background that is not plain hex passes through untouched so | ||
| # {{ chrome_seed_rgb }} still resolves instead of leaking a placeholder. | ||
| if [[ -z ${THEME_COLORS[chrome_seed]+_} && -n ${THEME_COLORS[background]+_} ]]; then |
There was a problem hiding this comment.
Explicit RGB seeds become placeholders If a theme sets
chrome_seed = "18,52,86", the palette parser accepts it and browser policy could use it as an RGB triple. But an explicit seed skips this branch, and the template renderer creates chrome_seed_rgb only from six-digit hex values. The generated chromium.theme therefore contains the literal {{ chrome_seed_rgb }} placeholder, causing browser sync to use the fallback color instead of the requested seed.
Knowledge Base Used: Theme switching and application sync
| assert_chromium_theme \ | ||
| "a non-hex background passes through as the chrome seed" \ | ||
| "rgba(010203ee) rgba(040506ee) 45deg" "rgba(010203ee) rgba(040506ee) 45deg" "" |
There was a problem hiding this comment.
Test accepts unusable browser color This test expects a gradient string in
chromium.theme, but browser sync accepts only an RGB triple and falls back for that output. The test therefore passes even though the generated file cannot supply the browser color, leaving this handoff untested.
Knowledge Base Used: Theme catalog and assets
Summary
BrowserThemeColoris a seed, not a paint color: Chromium derives the browser chrome color from it by adjusting lightness while preserving HSL saturation. At the luminance extremes HSL saturation is degenerate — a near-black seed'smax+minis tiny (sos = (max-min)/(max+min)→ 1.0 for any tint) and a near-white seed whose max channel is 255 also yieldss = 1.0. A barely-tinted near-black background therefore renders the tab strip as a loud saturated tone of that hue: a theme withbackground = "#000107"renders Chromium's chrome as saturated blue#0018AC(#10696; dark-theme counterpart of #7624). Omarchy's fallback#1c2027is blue-hued and does the same.This changes the generated
chromium.themeto use a clamped chrome seed instead of the raw background, and makes the browser-policy fallback neutral:bin/omarchy-theme-set-templates: derivechrome_seedfrombackground; seeds at the luminance extremes (max == 255ormax + min <= 16) with small chroma (<= 32) are neutralized to their channel average, so near-black and near-white backgrounds keep near-neutral chrome while genuinely colored backgrounds keep their hue.default/themed/chromium.theme.tpl:{{ background_rgb }}→{{ chrome_seed_rgb }}.install/helpers/browser-policy.sh: fallback#1c2027→ neutral#1f1f1f, with the reason in a comment.docs/theming.md,manual/43-making-your-own-theme.md).test/shell.d/chrome-seed-test.sh; fallback pins updated inbrowser-policy-dir-test.shandbrowser-policy-sudoers-test.sh.Theme authors who ship an explicit
chromium.themekeep full control of their seed.Verification
Standalone check of the clamp:
#000107→030303,#fffcf0→f9f9f9,#222222/#ff0000/#1a1b26/#738555/#ffffff/#1c2027unchanged../test/cli: 112 ok, 0 failures./test/shell: 231 passed / 5 failed — the 5 failures reproduce on a clean quattro tree (verified viagit stash), so they are pre-existing and unrelatedtheme-staging-test.sh,browser-policy-dir-test.sh,browser-policy-sudoers-test.sh,chrome-seed-test.sh: all passRendered behavior on Chromium 151 (before → after, measured from screenshots): tab strip for a
#000107background goes from saturated blue#0018ACto neutral dark; the olive-seeded case renders dark olive tones matching the theme accent. Before/after captures attached.Note: this intentionally does not touch
BrowserColorScheme: "device"— that is #10054 / #10056.