File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -974,6 +974,39 @@ so it has meaningful values for the channels.</p>
974974 which determines how "colorful" the color is.)
975975</div>
976976
977+ <div class="example" id="ex-no-percentage-magic">
978+ <p> Beware when using components outside their normal position;
979+ when percentages are resolved,
980+ there is no "magic scaling"
981+ to account for the changed position.
982+ For example,</p>
983+
984+ <pre>
985+ color: color(from color(srgb 0 0 0 / 60%) srgb alpha 0.6 0.6 / 0.9);
986+ </pre>
987+
988+ <p> The alpha component is resolved as a <<number>> ,
989+ giving 0.6; thus the resulting color is
990+ <span class="swatch" style="--color: rgb(60% 60% 60% / 0.9)"></span> ''color(srgb 0.6 0.6 0.6 / 0.9)'' .
991+ </p>
992+
993+ <p> However, in this second example, again the alpha resolves to 0.6,
994+ giving a very different color due to the color component range in
995+ legacy rgb() syntax:
996+ </p>
997+
998+ <pre>
999+ color: rgb(from rgb(0 0 0 / 60%) alpha 153 153 / 0.9);
1000+ </pre>
1001+
1002+ <p> which results in
1003+ <span class="swatch" style="--color: rgb(0.235% 60% 60% / 0.9)"></span> ''rgb(0.6 153 153 / 0.9)''
1004+ and not
1005+ <span class="swatch" style="--color: rgb(153 153 153 / 0.9)"></span> ''rgb(153 153 153 / 0.9)'' .
1006+ </p>
1007+
1008+ </div>
1009+
9771010Missing components are handled the same way as with
9781011[[css-color-4#interpolation-missing]] :
9791012the origin colorspace and the relative function colorspace
You can’t perform that action at this time.
0 commit comments