Skip to content

Commit 4e94292

Browse files
emiliosvgeesus
authored andcommitted
[css-color-5] Define light-dark().
Closes #7561.
1 parent 93c087a commit 4e94292

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

css-color-5/Overview.bs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ spec:css-color-4; type:value; text:srgb
3434
spec:css-color-4; type:dfn; text:modern color syntax
3535
spec:css-color-4; type:value; text:alpha-value
3636
spec:css-values-5; type:value; text:color
37+
spec:css-color-adjust-1; type:value; text:light
38+
spec:css-color-adjust-1; type:value; text:dark
3739
</pre>
3840
<link rel="stylesheet" href="style.css" />
3941
<style>
@@ -102,8 +104,8 @@ Introduction {#intro}
102104
and two colors with visually different lightness,
103105
like yellow and blue, can have the same HSL lightness).
104106

105-
This module adds a new function:
106-
''color-mix()'',
107+
This module adds the new functions
108+
''color-mix()'' and ''light-dark()'',
107109
and extends existing ones with [[#relative-colors|relative color syntax]].
108110

109111
It also extends the ''color()'' function
@@ -121,7 +123,7 @@ Introduction {#intro}
121123
Colors in CSS are represented by the <dfn export><<color>></dfn> type:
122124

123125
<pre class='prod'>
124-
&lt;color> = <<absolute-color-base>> | currentcolor | <<system-color>> | <<device-cmyk()>>
126+
&lt;color> = <<absolute-color-base>> | currentcolor | <<system-color>> | <<device-cmyk()>> | <<light-dark()>>
125127
126128
<dfn>&lt;absolute-color-base></dfn> = <<hex-color>> | <<absolute-color-function>> | <<named-color>> | transparent
127129
<dfn>&lt;absolute-color-function></dfn> = <<rgb()>> | <<rgba()>> |
@@ -2468,6 +2470,22 @@ or any other color or monochrome output device which has been characterized.
24682470
<li>alpha is the same as the input color
24692471
</ul>
24702472

2473+
<h2 id="light-dark">
2474+
Reacting to the used color-scheme: the ''light-dark()'' Function
2475+
</h2>
2476+
2477+
System colors have the ability to react to the current used ''color-scheme'' value.
2478+
The ''light-dark()'' function exposes the same capability to authors.
2479+
2480+
<pre class='prod'>
2481+
<dfn export>light-dark()</dfn> = light-dark( <<color>>, <<color>> )
2482+
</pre>
2483+
2484+
This function computes to the computed value of the first color,
2485+
if the <a>used color scheme</a> is ''light'' or unknown,
2486+
or to the computed value of the second color,
2487+
if the <a>used color scheme</a> is ''dark''.
2488+
24712489
<!--
24722490
████ ██ ██ ████████ ████████ ████████ ████████ ███████ ██ ███ ████████ ████████
24732491
██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██

0 commit comments

Comments
 (0)