Skip to content

Comments

Add color_scheme_dark member and themeable members (colors only)#1207

Open
christianliebel wants to merge 2 commits intomainfrom
dark-mode-colors
Open

Add color_scheme_dark member and themeable members (colors only)#1207
christianliebel wants to merge 2 commits intomainfrom
dark-mode-colors

Conversation

@christianliebel
Copy link
Member

@christianliebel christianliebel commented Feb 10, 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

@christianliebel christianliebel changed the title Add color_scheme_dark member and themeable members (colors only) Add color_scheme_dark member and themeable members (colors only) Feb 10, 2026
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 a manifest-level mechanism to specify dark-mode overrides for color-related members, addressing the need to provide different theme/background colors for light vs. dark color schemes (Issue #975).

Changes:

  • Marks theme_color and background_color as “themeable members”.
  • Introduces a new color_scheme_dark manifest member (ordered map) to hold dark-theme overrides.
  • Adds a processing algorithm for color_scheme_dark and hooks it into the manifest processing steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The [=manifest's=] <code><dfn data-export="" data-dfn-for=
"manifest">color_scheme_dark</dfn></code> member is an [=ordered
map=] whose keys are the names of [=themeable members=], while the
values are their corresponding theme overrides.
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

"theme overrides" is introduced here but not defined elsewhere in the document. Consider either defining what a "theme override" is (including its value type) or rephrasing to state that the values are the same types as the corresponding members (e.g., color strings) and are processed with the existing color-member processing algorithm.

Suggested change
values are their corresponding theme overrides.
values are their corresponding <dfn>theme overrides</dfn>. A theme
override is a value of the same type as its corresponding
[=themeable member=] (for example, a color string for a color
member) and is processed using that member's existing processing
algorithm.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we do this, we could avoid having the algorithm below. But - I'm generally a fan of algorithms in spec.....

One idea without the algorithm, we can:

  • When we define a 'themeable member', we can say the member may be changed based the color theme of the operating system.
  • We define "color_scheme_dark" as a "theme"
  • When parsing a 'theme', kind of like *_Localized, we apply these values on top of the manifest json if that theme is being used. This makes it so we don't have to define parsing of the fields.

What do you think?

</p>
<aside class="example" title="Example manifest with a dark theme">
<pre class="json">
{
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

The JSON example contains trailing whitespace after the opening { on the first line of the snippet. Please remove the trailing space to keep the spec source clean (and avoid whitespace-only diffs if tooling normalizes it).

Suggested change
{
{

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@dmurph dmurph left a comment

Choose a reason for hiding this comment

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

I think the current version should 'work' - but interested in your thoughts on alternative design here.
Sorry for review delay - was trying to think about the alternative way here.

If you prefer this way, then we can keep it. Happy to hear others thoughts though

The [=manifest's=] <code><dfn data-export="" data-dfn-for=
"manifest">color_scheme_dark</dfn></code> member is an [=ordered
map=] whose keys are the names of [=themeable members=], while the
values are their corresponding theme overrides.
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we do this, we could avoid having the algorithm below. But - I'm generally a fan of algorithms in spec.....

One idea without the algorithm, we can:

  • When we define a 'themeable member', we can say the member may be changed based the color theme of the operating system.
  • We define "color_scheme_dark" as a "theme"
  • When parsing a 'theme', kind of like *_Localized, we apply these values on top of the manifest json if that theme is being used. This makes it so we don't have to define parsing of the fields.

What do you think?

<dfn>theme color</dfn> is defined in [[HTML]].
</p>
<p>
The [=manifest/theme_color=] member is a [=themeable member=].
Copy link
Member

Choose a reason for hiding this comment

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

This should be:

Suggested change
The [=manifest/theme_color=] member is a [=themeable member=].
The [=manifest/theme_color=] member is a [=manifest/themeable member=].

values are their corresponding theme overrides.
</p>
<p>
A <dfn>themeable member</dfn> is a [=manifest=] member that can be
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
A <dfn>themeable member</dfn> is a [=manifest=] member that can be
A <dfn data-dfn-for="manifest">themeable member</dfn> is a [=manifest=] member that can be

</p>
<aside class="note">
Because the [=themeable members=] were defined prior to the
introduction of dark mode, they are implicitly treated as the light
Copy link
Member

@marcoscaceres marcoscaceres Feb 16, 2026

Choose a reason for hiding this comment

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

Nit: link to "dark" mode?

https://drafts.csswg.org/mediaqueries-5/#valdef-media-prefers-color-scheme-dark

Maybe we should ask the CSS folks to define "dark" mode and "light" mode independently of the the value (i.e., as a concept we can link to)

Comment on lines +1547 to +1549
The [=manifest/color_scheme_dark=] member's [=ordered map=] accepts
[=themeable members=] as keys, and their values as the theme
overrides.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The [=manifest/color_scheme_dark=] member's [=ordered map=] accepts
[=themeable members=] as keys, and their values as the theme
overrides.
The [=manifest/color_scheme_dark=] member's [=ordered map=] accepts
[=themeable members=] as keys, and their values as
overrides.

</li>
<li>Let |colorScheme| be |json|["color_scheme_dark"].
</li>
<li>If |colorScheme| is not an [=ordered map=], return.
Copy link
Member

@marcoscaceres marcoscaceres Feb 16, 2026

Choose a reason for hiding this comment

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

This should be an object, no?

Suggested change
<li>If |colorScheme| is not an [=ordered map=], return.
<li>If |colorScheme| is not an {{Object}}, return.

<li>Let |processedColorScheme:ordered map| be a new [=ordered
map=].
</li>
<li>[=Map/Set=] |manifest|["color_scheme_dark"] to
Copy link
Member

Choose a reason for hiding this comment

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

I was expecting to loop over the key value pairs of the |colorScheme|, and then switching on the key to process the value. But also, we should be clear what happens when there are repeated entries. I can't recall if first or last wins... but should follow what the other processing does.

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)

3 participants