Skip to content

Commit b3c3be5

Browse files
committed
[css-color-adjust-1] Squash the first two color-scheme examples together and lightly edit the text. Add examples of using single values.
1 parent 731a8ff commit b3c3be5

File tree

1 file changed

+54
-10
lines changed

1 file changed

+54
-10
lines changed

css-color-adjust-1/Overview.bs

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -222,36 +222,80 @@ Opting Into a Preferred Color Scheme: the 'color-scheme' property {#color-scheme
222222
is still not guaranteed to have any effect on the rendering of the element.
223223

224224
<div class=example>
225-
A well-written page--
226-
one that responds to user preferences for light or dark display
225+
A page that responds to user preferences for light or dark display
227226
by using the 'prefers-color-scheme' media feature
228-
to alter the colors it uses--
227+
to alter the colors it uses
229228
can easily opt the browser-controlled UI
230229
(scrollbars, inputs, etc)
231-
into the user's preferred color scheme as well
230+
to match
232231
with a simple global declaration:
233232

234233
<pre highlight=css>
235234
:root {
236235
color-scheme: light dark;
237236
}
238237
</pre>
238+
239+
If a page limits itself to using <em>only</em> the <<system-color>>s,
240+
the 'color-scheme' declaration, above,
241+
will support the user's preferred color scheme
242+
even without the author needing to use ''@media'' at all.
239243
</div>
240244

241245
<div class=example>
242-
If a page limits itself to using <em>only</em> the <<system-color>>s,
243-
it can support the user's preferred color scheme
244-
without needing to use ''@media'' at all,
245-
simply by using the 'color-scheme' property:
246+
If a page cannot reasonably accommodate all color schemes,
247+
such as for branding or theatrical reasons,
248+
'color-scheme' can still indicate which color schemes the page <em>can</em> support,
249+
causing the UI to match.
250+
251+
If the page's color scheme is primarily light,
252+
the following will indicate that explicitly:
253+
254+
<pre highlight=css>
255+
:root {
256+
color-scheme: light;
257+
}
258+
</pre>
259+
260+
While if the page is primarily dark,
261+
indicating that explicitly will make the page look more coherent as well:
262+
263+
<pre highlight=css>
264+
:root {
265+
color-scheme: dark;
266+
}
267+
</pre>
268+
269+
However, it is better to support both color schemes,
270+
of course.
271+
</div>
272+
273+
<div class=example>
274+
A page might be generally capable of handling multiple color schemes,
275+
while still having a sub-section that needs to be rendered in a particular color scheme.
276+
277+
For example,
278+
a style guide might give several UI examples that are using light or dark colors,
279+
showing off the light or dark theme specifically.
280+
This can be indicated as:
246281

247282
<pre highlight=css>
248283
:root {
249284
color-scheme: light dark;
250285
}
286+
287+
.light-theme-example {
288+
color-scheme: light;
289+
}
290+
291+
.dark-theme-example {
292+
color-scheme: dark;
293+
}
251294
</pre>
252295

253-
because the [=used color scheme=]
254-
affects what <<system-color>>s resolve to.
296+
Only the subsections rooted at ''.light-theme-example'' or ''.dark-theme-example''
297+
will be opted into the ''light'' or ''dark'' themes specifically;
298+
the rest of the page will respect the user's preference.
255299
</div>
256300

257301
Note: [[HTML]] specifies a

0 commit comments

Comments
 (0)