Fix Chromium's tab strip turning bright yellow under a warm light theme
The colour math is genuinely correct. For a light colour with any channel at 255, HSL saturation computes to 1.0, and the 3*max - min >= 510 test is the right algebraic form of S>=0.5 when L>0.5. The policy path /etc/chromium/policies/managed and the BrowserThemeColor key are confirmed in bin/omarchy-theme-set-browser. But the theme names are wrong: tufte is NOT one of the 22 shipped Omarchy themes. The theme whose background is #fffcf0 is flexoki-light. latte is catppuccin-latte. I verified the actual backgrounds: flexoki-light #FFFCF0 -> 525 (triggers), rose-pine #faf4ed -> 513 (triggers, and Omarchy's rose-pine is mode="light"), catppuccin-latte #eff1f5 -> 496 (fine), white #ffffff is achromatic so S=0 (fine, though the record's own test returns exactly 510 for it). The fix also drops the BrowserColorScheme: "device" key that omarchy-theme-set-browser writes alongside the colour, and the hook's sudo -n fails silently without passwordless sudo.
The hook writes to /etc/chromium/policies/managed/ with sudo on every theme change. sudo -n will fail silently without a NOPASSWD sudoers rule for exactly that file. If you are not comfortable adding one, write the policy once by hand instead of on every switch.
Symptom
With a light theme whose background is a warm near-white (tufte, #fffcf0, is the usual culprit), the Chromium tab strip renders bright yellow (#ffde5a) instead of the theme color. Dark themes and neutral light themes such as latte (#eff1f5) are fine. /etc/chromium/policies/managed/color.json correctly contains BrowserThemeColor: #fffcf0.
Cause
Chromium derives the tab strip color from the seed by darkening it while preserving hue and saturation. In Skia's HSL, any channel at 255 counts as fully saturated (s=1.0), so a cream like #fffcf0 is treated as a fully saturated yellow and darkens to a saturated yellow rather than to a warm grey. The policy file and the Omarchy state are both correct. The derivation is what goes wrong.
Fix
**Theme-name correction.** tufte is not an Omarchy theme. The shipped set is catppuccin, catppuccin-latte, ethereal, everforest, flexoki-light, gruvbox, hackerman, kanagawa, last-horizon, lumon, lupine, matte-black, miasma, nord, osaka-jade, retro-82, ristretto, rose-pine, solitude, tokyo-night, vantablack, white. The theme with background #fffcf0 is **flexoki-light**. Verified against each theme's colors.toml using the 3*max - min >= 510 test:
flexoki-light #FFFCF0 -> 525 triggers
rose-pine #faf4ed -> 513 triggers (Omarchy's rose-pine is mode = "light")
catppuccin-latte #eff1f5 -> 496 fine
white #ffffff -> achromatic (max == min), S = 0, fine
Seed Chromium with a slightly darkened colour, and **keep the BrowserColorScheme key** that omarchy-theme-set-browser writes, because dropping it changes Chromium's light/dark behaviour:
sudo tee /etc/chromium/policies/managed/color.json >/dev/null <<'JSON'
{ "BrowserThemeColor": "#f5f2e6", "BrowserColorScheme": "device" }
JSON
pkill -x chromium
Chromium re-reads managed policy only at startup, so it must be fully quit.
Hook version. It runs after omarchy-theme-set-browser, so it wins. The theme-set hook receives the theme name as $1, so reading current/theme.name is unnecessary. Test the sudo -n line by hand once, because without passwordless sudo it fails silently:
mkdir -p ~/.config/omarchy/hooks/theme-set.d
cat > ~/.config/omarchy/hooks/theme-set.d/30-chromium-seed.sh <<'EOF'
#!/bin/bash
case "$1" in
flexoki-light|rose-pine)
printf '{ "BrowserThemeColor": "#f5f2e6", "BrowserColorScheme": "device" }\n' \
| sudo -n tee /etc/chromium/policies/managed/color.json >/dev/null \
|| echo "chromium seed hook: passwordless sudo required" >&2
;;
esac
EOF
chmod +x ~/.config/omarchy/hooks/theme-set.d/30-chromium-seed.sh
Verify
Reopen Chromium under the tufte theme. The tab strip is a warm off-white/grey rather than #ffde5a. chrome://policy shows the BrowserThemeColor value you set.