Add color_scheme_dark member and themeable members (colors only)#1207
Add color_scheme_dark member and themeable members (colors only)#1207christianliebel wants to merge 2 commits intomainfrom
color_scheme_dark member and themeable members (colors only)#1207Conversation
color_scheme_dark member and themeable members (colors only)
There was a problem hiding this comment.
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_colorandbackground_coloras “themeable members”. - Introduces a new
color_scheme_darkmanifest member (ordered map) to hold dark-theme overrides. - Adds a processing algorithm for
color_scheme_darkand 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. |
There was a problem hiding this comment.
"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.
| 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. |
There was a problem hiding this comment.
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"> | ||
| { |
There was a problem hiding this comment.
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).
| { | |
| { |
dmurph
left a comment
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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=]. |
There was a problem hiding this comment.
This should be:
| 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 |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
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)
| The [=manifest/color_scheme_dark=] member's [=ordered map=] accepts | ||
| [=themeable members=] as keys, and their values as the theme | ||
| overrides. |
There was a problem hiding this comment.
| 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. |
There was a problem hiding this comment.
This should be an object, no?
| <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 |
There was a problem hiding this comment.
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.
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