Skip to content

Commit

Permalink
[css-color-6] Prepare prose for multiple contrast algorithms, see #7357
Browse files Browse the repository at this point in the history
Co-Authored-By: fantasai <725717+fantasai@users.noreply.github.com>
  • Loading branch information
LeaVerou and fantasai committed Oct 20, 2022
1 parent b7e5000 commit b860b74
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions css-color-6/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,20 @@ Computing a Contrasting Color: the ''contrast-color()'' function {#colorcontrast
or as a background against a list of [=color candidate|candidate=] text colors.
(The effective contrast of a pair of colors depends on their usage.)

ISSUE (#7359): The keywords to specify whether the [=base color=] is a foreground or background are <abbr title="to be decided">TBD</abbr>.
ISSUE(#7359): The keywords to specify whether the [=base color=] is a foreground or background are <abbr title="to be decided">TBD</abbr>.

The <dfn><<target-contrast>></dfn> argument specifies the contrast algorithm to use.
The <dfn><<target-contrast>></dfn> argument specifies the contrast algorithm(s) to use.
If no [=color candidates=] have been provided,
<<target-contrast>> may be omitted,
in which case a UA-chosen algorithm is used.

Arguments to a <<target-contrast>> [=functional notation=]
indicate the <dfn>target contrast level</dfn>.
Multiple contrast algorithms with [=target contrast levels=] may be specified,
in which case all their requirements are simultaneously applied.
A ''contrast-color()'' function specifying multiple algorithms
must specify a [=target contrast level=] for each algorithm,
and is otherwise [=invalid=].

If the [=target contrast level=] is omitted,
the color candidate with the greatest contrast is returned.
Expand All @@ -120,9 +126,13 @@ If there is a target contrast</h4>
Candidate colors are tested sequentially,
starting with the first color in the list,
and ending with an automatically appended ''white, black''.
The first color to pass the specified level of contrast
The first color to pass the specified level(s) of contrast
against the [=base color=] wins.

If no candidate color passes, then whichever of ''white'' or ''black'' has the highest contrast
according to the first specified algorithm wins.
If they both have the same contrast, ''white'' wins.

<!-- live example
https://colorjs.io/notebook/?storage=https%3A%2F%2Fgist.github.com%2Fsvgeesus%2Fec249f376fcecbaa8794f75dbfc1dacf
-->
Expand Down

0 comments on commit b860b74

Please sign in to comment.