Skip to content
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
20 changes: 7 additions & 13 deletions css-color-5/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2606,23 +2606,17 @@ or any other color or monochrome output device which has been characterized.
the surrounding colors, etc.

<pre class='prod'>
<dfn export>contrast-color()</dfn> = contrast-color( <<color>> max? )
<dfn export>contrast-color()</dfn> = contrast-color( <<color>> )
</pre>

If ''max''' is specified, the function computes to ''white'' or ''black'',
depending on which of the two produces _maximum_ color contrast for text when the input color is used as a solid background.
If both colors produce the same contrast, the function should return ''white''.

If ''max''' is omitted, the function computes to a <em>very light</em> or <em>very dark</em> color (which <em>may</em> still be white or black),
which will contrast well with the input color when used as a text color and the input color is used as a solid background.
The function MUST return a light color if it would have returned ''white'' if ''max'' were specified,
and a dark color if it would have returned ''black'' if ''max'' were specified.

Note: The precise requirement for how close these colors need to be to white and black
and what color difference measure to use for that are still under discussion.
''contrast-color()'' resolves to either ''white'' or ''black'',
whichever produces <strong>maximum</strong> color contrast for text
when the input color is used as a solid background.
If both ''white'' and ''black'' produce the same contrast,
it resolves to ''white''.

The precise color contrast algorithm for determining whether to output a light or dark color
is UA-defined at this level, as is the precise color produced when ''max''' is omitted.
is UA-defined at this level.

Note: Future versions of this specification are expected to introduce more control over
both the contrast algorithm(s) used, the use cases, as well as the returned color.
Expand Down