Skip to content

Comments

Add color_scheme_dark member and themeable members#1205

Open
christianliebel wants to merge 1 commit intomainfrom
dark-mode
Open

Add color_scheme_dark member and themeable members#1205
christianliebel wants to merge 1 commit intomainfrom
dark-mode

Conversation

@christianliebel
Copy link
Member

@christianliebel christianliebel commented Jan 29, 2026

Closes #975

This change (choose at least one, delete ones that don't apply):

  • Adds new normative requirements

Implementation commitment (delete if not making normative changes):

If change is normative, and it adds or changes a member:

Commit message:

Add color_scheme_dark member and themeable members

Person merging, please make sure that commits are squashed with one of the following as a commit message prefix:

  • chore:
  • editorial:
  • BREAKING CHANGE:
  • And use none if it's a normative change

Preview | Diff

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and background_color (and shortcut icons) as “themeable members”.
  • Defines manifest/color_scheme_dark and shortcut 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.

Comment on lines +1569 to +1570
[=themeable members=] as keys, and their values as the theme
overrides.
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
[=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.

Copilot uses AI. Check for mistakes.
corresponding theme overrides.
</p>
<p>
A <dfn>themeable member</dfn> is a [=manifest=] member that can be
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
<li>[=Process a color member=] passing |colorScheme|,
|processedColorScheme|, "background_color".
</li>
<li>[=Process image resources=] passing |colorScheme|["icons"],
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
<li>[=Process image resources=] passing |colorScheme|["icons"],
<li>If |colorScheme|["icons"] [=map/exist=] and is a [=list=], then
[=Process image resources=] passing |colorScheme|["icons"],

Copilot uses AI. Check for mistakes.
Comment on lines +2587 to +2588
<li>[=Process image resources=] passing |colorScheme|["icons"],
|processedColorScheme|, |manifest URL|, and "icons".
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
<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".

Copilot uses AI. Check for mistakes.
@christianliebel
Copy link
Member Author

.cc @carlosjeurissen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for defining a theme color for both light & dark modes (prefers color scheme)

1 participant