Open
Bug 2070312
Opened 2 months ago
Updated 2 months ago
Dynamic wallpapers: select the light/dark variant matching the user's theme
Categories
(Firefox :: New Tab Page, task)
Firefox
New Tab Page
Tracking
()
NEW
People
(Reporter: gharp, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [hnt][hnt-wattle])
When the dynamic wallpapers control is on, the applied Firefox-category wallpaper should be the variant that matches the user's current theme, and should follow the theme when it changes.
This bug is the selection logic only. It assumes the control already exists and is on; wiring up the control itself, any picker changes, and any new strings are separate bugs under bug 2070282.
Scope
- Firefox wallpaper category only. Colors, Photos, Abstracts, Celestial, and custom uploads are unchanged.
- Selection keys off the resolved content color scheme rather than specific theme IDs. Built-in Firefox themes and static themes from addons.mozilla.org are therefore handled by the same path, and a theme declaring color_scheme "system" resolves to the OS appearance.
Out of scope
- The dynamic control itself, and any other UI or picker changes
- New or changed strings
- Telemetry
- Behavior when the control is off, which stays exactly as it is today
Current state
- The newtab-wallpapers-v2 records already carry a theme field of "light" or "dark", so per-record theme is known; what is missing is any field expressing which two records are variants of each other.
- The six existing pairs use three different naming conventions (firefox-a / firefox-a-light, firefox-c / firefox-c-dark, firefox-desert-dark / firefox-desert-light), so pairing cannot be derived from the title. An explicit field, in the spirit of the existing visibility_group, is likely the answer.
- LightweightThemeConsumer already resolves a color scheme for every lightweight theme, including add-on themes: the active variant if the theme ships both, otherwise the manifest's color_scheme or content_color_scheme, otherwise derived from the theme's colors by luminance. It writes browser.theme.content-theme and sets browsingContext.prefersColorSchemeOverride, so prefers-color-scheme inside about:newtab already reflects the active theme. See toolkit/modules/LightweightThemeConsumer.sys.mjs.
Acceptance criteria
- A wallpaper record can express which other record is its opposite-theme variant, and the mechanism is defined in the collection schema rather than inferred from the title.
- With the control on and a Firefox-category wallpaper applied, switching the theme between light and dark swaps the applied wallpaper to the matching variant with no user action and no new tab reload required.
- The applied wallpaper reacts to theme changes as such, not only to OS-level appearance changes. Switching between Firefox Light and Firefox Dark is not an OS event and must still update the wallpaper.
- The same behavior holds for a static theme installed from addons.mozilla.org, without that theme being named or special-cased anywhere in the newtab code.
- Under the System/Automatic theme, or a theme declaring color_scheme "system", the wallpaper follows the resolved appearance, including an OS-level light/dark switch made mid-session.
- Turning the control on while a non-matching variant is applied switches the applied wallpaper to the matching variant.
- A Firefox-category wallpaper with no counterpart variant stays applied and unchanged when the theme changes. The intent is for every Firefox-category wallpaper to have a light/dark counterpart, but five do not today (Wrexham, firefox-bold, firefox-e, firefox-f, firefox-orange), so the unpaired path must behave correctly rather than being treated as unreachable. Producing the missing counterpart assets is tracked separately.
- The selection survives restart: the applied wallpaper still matches the theme on the next launch.
- Test coverage for each of the above, including an add-on theme, the unpaired case, and the System/Automatic case.
Updated•2 months ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•