Add color_scheme_dark member and themeable members#1205
Add color_scheme_dark member and themeable members#1205christianliebel wants to merge 1 commit intomainfrom
color_scheme_dark member and themeable members#1205Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for defining dark-mode theme overrides in the Web App Manifest by introducing a color_scheme_dark member and identifying which members are “themeable” (and thus eligible for dark-mode overrides).
Changes:
- Marks
icons,theme_color, andbackground_color(and shortcuticons) as “themeable members”. - Defines
manifest/color_scheme_darkandshortcut item/color_scheme_dark, including processing steps. - Hooks
Process the \color_scheme_dark` member` into the main manifest processing algorithm.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [=themeable members=] as keys, and their values as the theme | ||
| overrides. |
There was a problem hiding this comment.
The color_scheme_dark definition says its keys can be themeable members and their corresponding localizable members (e.g., icons_localized), but the “Theming themeable members” paragraph says the map accepts only themeable members as keys. Please align the wording so it consistently includes the *_localized companion keys (or redefine them as themeable) to avoid ambiguity about what keys are allowed.
| [=themeable members=] as keys, and their values as the theme | |
| overrides. | |
| [=themeable members=] and their corresponding [=localizable members=] | |
| as keys, with their values as the theme overrides. |
| corresponding theme overrides. | ||
| </p> | ||
| <p> | ||
| A <dfn>themeable member</dfn> is a [=manifest=] member that can be |
There was a problem hiding this comment.
themeable member is defined as “a manifest member that can be themed”, but the term is also used for shortcut item/icons, which is not a top-level manifest member. Please broaden the definition so it applies to members of nested manifest structures (e.g., shortcut items) as well, or avoid using the same term for shortcut-item members.
| A <dfn>themeable member</dfn> is a [=manifest=] member that can be | |
| A <dfn>themeable member</dfn> is a member of the [=manifest=] or of | |
| a nested manifest structure (such as a shortcut item) that can be |
| <li>[=Process a color member=] passing |colorScheme|, | ||
| |processedColorScheme|, "background_color". | ||
| </li> | ||
| <li>[=Process image resources=] passing |colorScheme|["icons"], |
There was a problem hiding this comment.
Process image resources always sets map[member] to a new (possibly empty) list before validating images (see Processing image resources at index.html:2364-2370). Calling it unconditionally here means that if color_scheme_dark.icons is absent, the processed dark-scheme override will still contain an empty icons list, which prevents inheriting the main icons and can effectively remove icons in dark mode. Consider only invoking Process image resources when "icons" exists in |colorScheme| (and is a list), so absence cleanly falls back to the light-scheme icons.
| <li>[=Process image resources=] passing |colorScheme|["icons"], | |
| <li>If |colorScheme|["icons"] [=map/exist=] and is a [=list=], then | |
| [=Process image resources=] passing |colorScheme|["icons"], |
| <li>[=Process image resources=] passing |colorScheme|["icons"], | ||
| |processedColorScheme|, |manifest URL|, and "icons". |
There was a problem hiding this comment.
Same inheritance issue for shortcut-item theming: Process image resources always sets processedColorScheme["icons"] to an empty list even when color_scheme_dark.icons is missing/invalid (index.html:2364-2370). This makes a present-but-partial shortcut item/color_scheme_dark override wipe out the base shortcut icons. Add a presence/type check for |colorScheme|["icons"] before processing so missing icons inherits from the light-scheme shortcut icons.
| <li>[=Process image resources=] passing |colorScheme|["icons"], | |
| |processedColorScheme|, |manifest URL|, and "icons". | |
| <li>If "icons" [=map/exists=] in |colorScheme| and | |
| |colorScheme|["icons"] is a [=list=], then [=Process image | |
| resources=] passing |colorScheme|["icons"], |processedColorScheme|, | |
| |manifest URL|, and "icons". |
|
.cc @carlosjeurissen |
Closes #975
This change (choose at least one, delete ones that don't apply):
Implementation commitment (delete if not making normative changes):
If change is normative, and it adds or changes a member:
Commit message:
Add
color_scheme_darkmember and themeable membersPerson merging, please make sure that commits are squashed with one of the following as a commit message prefix:
Preview | Diff