Skip to content

[css-color-5] Define light-dark(). #9439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions css-color-5/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ spec:css-color-4; type:value; text:srgb
spec:css-color-4; type:dfn; text:modern color syntax
spec:css-color-4; type:value; text:alpha-value
spec:css-values-5; type:value; text:color
spec:css-color-adjust-1; type:value; text:light
spec:css-color-adjust-1; type:value; text:dark
</pre>
<link rel="stylesheet" href="style.css" />
<style>
Expand Down Expand Up @@ -102,8 +104,8 @@ Introduction {#intro}
and two colors with visually different lightness,
like yellow and blue, can have the same HSL lightness).

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

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

<pre class='prod'>
&lt;color> = <<absolute-color-base>> | currentcolor | <<system-color>> | <<device-cmyk()>>
&lt;color> = <<absolute-color-base>> | currentcolor | <<system-color>> | <<device-cmyk()>> | <<light-dark()>>

<dfn>&lt;absolute-color-base></dfn> = <<hex-color>> | <<absolute-color-function>> | <<named-color>> | transparent
<dfn>&lt;absolute-color-function></dfn> = <<rgb()>> | <<rgba()>> |
Expand Down Expand Up @@ -2468,6 +2470,22 @@ or any other color or monochrome output device which has been characterized.
<li>alpha is the same as the input color
</ul>

<h2 id="light-dark">
Reacting to the used color-scheme: the ''light-dark()'' Function
</h2>

System colors have the ability to react to the current used ''color-scheme'' value.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be "currently" instead of "current".

Sebastian

The ''light-dark()'' function exposes the same capability to authors.

<pre class='prod'>
<dfn export>light-dark()</dfn> = light-dark( <<color>>, <<color>> )
</pre>

This function computes to the computed value of the first color,
if the <a>used color scheme</a> is ''light'' or unknown,
or to the computed value of the second color,
if the <a>used color scheme</a> is ''dark''.

<!--
████ ██ ██ ████████ ████████ ████████ ████████ ███████ ██ ███ ████████ ████████
██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
Expand Down