Skip to content

Fix Chromium browser policy color scheme - #10056

Closed
timolehto wants to merge 1 commit into
omacom:quattrofrom
timolehto:fix/browser-policy-color-scheme
Closed

timolehto wants to merge 1 commit into
omacom:quattrofrom
timolehto:fix/browser-policy-color-scheme

Conversation

@timolehto

Copy link
Copy Markdown

Fixes #10054.

Replaces the invalid BrowserColorScheme: "device" policy value with system in both writers, and adds a one-time migration to refresh existing policies.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for tracking this down. The error is real, but changing the value does not clear it: neither Chromium nor Chrome knows a policy called BrowserColorScheme, so chrome://policy rejects it whatever it is set to.

What was checked, on an Omarchy worker VM built from the ISO, with Chromium 152.0.7977.82:

  • With {"BrowserThemeColor": "#1c2027", "BrowserColorScheme": "device"} in /etc/chromium/policies/managed/color.json, chrome://policy shows BrowserColorScheme as Error, "Unknown policy". That reproduces BrowserColorScheme "device" is rejected by Chromium-family browsers #10054.
  • With "system", which is what this PR writes, it shows the same: Error, "Unknown policy".
  • With {"BrowserThemeColor": "#1c2027"} alone, the page is clean and BrowserThemeColor is OK.
  • The name BrowserColorScheme does not appear anywhere in the Chromium 152 binary or in Google Chrome 154.0.8037.97's, while BrowserThemeColor does. In Chromium's sorted policy table the Browser… names go straight from BrowserAddPersonEnabled through BrowserSwitcher… to BrowserThemeColor. Brave and Edge were not checked.

The key was added on purpose in 54b0517 ("Fix dark/light mode switching"), so whether to drop it is a call for the maintainer, and nothing has been pushed to this branch.

If this does go ahead, one more thing needs changing. Since #13038, bin/omarchy-theme-set-browser on quattro skips the privileged write when every color.json matches an expected JSON, and that still says "device". Merged as it stands, a root-owned "device" file would count as current, so the migration's call to omarchy-theme-set-browser would exit without rewriting anything. Every later theme switch would also take the privileged write, because the writer's output would never match. The expected JSON needs to match whatever the writers emit, with a test that a root-owned file carrying the old value gets rewritten. Merged with quattro and with that change, browser-policy-dir-test.sh, theme-set-browser-test.sh and browser-policy-sudoers-test.sh pass on the worker. At this head, browser-policy-dir-test.sh and browser-policy-sudoers-test.sh pass.

This was reviewed by Claude Opus 5.5 alone. The second opinion (Codex Medium) did not run because omabot's daily review budget was used up. The reviewer itself was reachable.

Waiting on the maintainer to decide whether BrowserColorScheme should be dropped from the policy rather than changed.

@timolehto

Copy link
Copy Markdown
Author

Thanks for checking. Agreed: the problem is the key name, not its value. Closing this in favour of #14863, which drops BrowserColorScheme entirely.

Where the name comes from. The archived Omarchy Chromium fork set the colour scheme through a command-line switch, not a policy: 001-omarchy-theme-switcher.patch adds --set-color-scheme=system|light|dark, mapped onto Chromium's internal ThemeService::BrowserColorScheme enum. That is where system in this PR came from. The patch adds no policy handling, so BrowserColorScheme was never a valid policy, not even in the fork.

Why it no longer applies. bcd52fa ("Switch back to mainline chromium", 2026-01-28) replaced omarchy-chromium with upstream chromium and replaced the --set-theme-color / --set-color-scheme switches with the BrowserThemeColor managed policy, which upstream does support. The BrowserColorScheme key was added after that, in 54b0517 (2026-03-27), to a browser that has never known it. Upstream Chromium has no policy for light/dark/device mode; that is a per-user setting, so the key cannot work under any value.

Brave doesn't define it either. None of brave-core's 30 policy definitions covers colour scheme. In both Chromium and Brave, BrowserColorScheme exists only as an internal ThemeService enum and profile preference, not as a policy.

Confirmed locally on Chromium 152.0.7977.82: chrome://policy reports "Unknown policy" for both device and system, and the name does not appear in the binary. Switching themes behaves identically with and without the key; #14863 has the details.

@timolehto timolehto closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BrowserColorScheme "device" is rejected by Chromium-family browsers

2 participants