Skip to content

Commit faea241

Browse files
author
Anders Hartvoll Ruud
committed
[css-color-5] Resolving color-contrast()
1 parent a22c4eb commit faea241

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

css-color-5/Overview.bs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,35 @@ Selecting the most contrasting color: the ''color-contrast()'' function {#colorc
682682
<!-- great example to use in WPT -->
683683
</div>
684684

685+
<h3 id="resolving-contrast">Resolving ''color-contrast()'' values</h3>
686+
687+
The computed and used value is the specified ''color-contrast()'' function
688+
with each <<color>> parameter resolved according to [[css-color-4#resolving-color-values]],
689+
and the keywords ''AA'', ''AA-large'', ''AAA'', ''AAA-large'' replaced with their corresponding numeric value.
690+
691+
<div class="example">
692+
693+
For example, given a current color value of
694+
<span class="swatch" style="--color: rgb(179 213 230)"></span> rgb(179 213 230),
695+
the value
696+
697+
<pre class="lang-css">
698+
color-contrast(currentColor vs hsl(200 83% 23%), purple to AA)
699+
</pre>
700+
701+
has the computed value
702+
703+
<pre class="lang-css">
704+
color-contrast(currentColor vs rgb(10 75 107), rgb(128 0 128) to 4.5)
705+
</pre>
706+
707+
and the used value
708+
709+
<pre class="lang-css">
710+
color-contrast(rgb(179 213 230) vs rgb(10 75 107), rgb(128 0 128) to 4.5)
711+
</pre>
712+
713+
</div>
685714

686715

687716
<!-- old color-adjust wording might be useful, on choice of color space for adjustment -->
@@ -1318,4 +1347,5 @@ Changes {#changes}
13181347
<li>allowed mix percent to default to 50%</li>
13191348
<li>added worked examples and diagrams</li>
13201349
<li>corrected minor spelling, syntax and formatting issues</li>
1350+
<li>Added section on resolving color-contrast() values</li>
13211351
</ul>

0 commit comments

Comments
 (0)