Stub out support for macOS/Windows theming and theme variants #596
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reviewer: @shakyShane
Asana Task: https://app.asana.com/1/137249556945/project/1209121419454298/task/1211790481771802
Tech Design: https://app.asana.com/1/137249556945/project/1209121419454298/task/1212083006586484?focus=true
Description:
Similar to duckduckgo/content-scope-scripts#2065 and duckduckgo/content-scope-scripts#2066.
Adds:
onChangeThemein macOS and Windows. (Previously only available in iOS/Android.)themeandthemeVarianttoonChangeThemeso that can set theme variant.I didn’t end up updating
resolveInitialRenderas planned because it’s easier for handling compatibility with the native apps ifthemeVariantis optional. We can add this later if it proves to be necessary (e.g. flashes of un-themed content).Intention here is to do the minimal amount needed to unblock the native apps. In follow up PRs I’ll import theme variables from the design-tokens repo and update more than just the background colour.
Steps to test this PR:
npm run preview&theme=darkor&theme=lightquery param.&themeVariant=roseor&themeVariant=desert.themeVariantshouldn’t have any affect herethemeVariantshouldn’t have any affect hereNote
Adds cross‑platform theming with optional variants, wiring onChangeTheme({ theme, themeVariant }) across platforms, updating schemas/CSS, and adding integration tests; also migrates Playwright config.
setColorSchemeand updatesonChangeThemeto accept a string or{ theme, themeVariant }, applyingbody--theme-*andbody--theme-variant-*classes.onChangeThemein macOS and Windows; refactors Android/iOS setup to use common handler andsetupColorScheme.shared/html/popup.html.ThemeVariantenum and extendsWindowsViewModelwith optionalthemeandthemeVariantfields.theme-light,theme-dark, variant cases).theme/themeVariantvia state and URL params and dispatchonChangeTheme.defineConfig.Written by Cursor Bugbot for commit 1494718. This will update automatically on new commits. Configure here.