#55970: fix: reflect system contrast preference in prefers-contrast media query
Merged
Description of Change
Electron never set preferred_contrast in its web preferences, unlike Chrome (which added it in https://chromium-review.googlesource.com/c/chromium/src/+/2412972), so prefers-contrast always matched no-preference even when nativeTheme.shouldUseHighContrastColors was true. This sets it from the native theme, mirroring Chrome's GetPreferredContrast, and includes it in the color-related needs-update check so a runtime change refreshes open pages; the new spec forces high contrast with --force-high-contrast.
Fixes #55917
Checklist
- I have filled out the PR description
- I have reviewed and verified the changes
- tests are changed or added
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, past tense, and no longer than 80 characters.
Release Notes
Notes: Fixed prefers-contrast media query ignoring the system's contrast setting.
Backports
Semver Impact
Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron