Skip to content

Commit 1525f02

Browse files
committed
[css-color-5]Clarify no RCS with legacy rgba() or hsla(), fix #7018
1 parent f000b68 commit 1525f02

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

css-color-5/Overview.bs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,30 @@ the allowed [=channel keywords=] are:
10851085
This takes the sRGB value of indianred (205 92 92) and replaces the red channel with 255 to give <span class="swatch" style="--color: rgb(255 92 92)"></span> rgb(255 92 92).
10861086
</div>
10871087

1088+
Relative color syntax is only applicable to the non-legacy RGB syntactic forms.
1089+
1090+
<div class="example invalid">
1091+
For example, this attempt to use the rgba
1092+
<a>legacy color syntax</a> would be incorrect
1093+
1094+
<pre>
1095+
rgba(from <span class="swatch" style="--color: darkblue">darkblue 16 32 b / 0.5</span> )
1096+
</pre>
1097+
</div>
1098+
1099+
<div class="example">
1100+
Instead, use
1101+
1102+
<pre>
1103+
rgb(from <span class="swatch" style="--color: darkblue">darkblue 16 32 b / 0.5</span> )
1104+
</pre>
1105+
1106+
This takes the sRGB value of darkblue (0 0 139) and replaces
1107+
the red, green and alpha channels to give
1108+
<span class="swatch" style="--color: rgb(16 32 139 / 0.5)"></span> rgb(16 32 139 / 0.5)
1109+
1110+
</div>
1111+
10881112
<h3 id="relative-HSL">Relative HSL colors</h3>
10891113

10901114
The grammar of the ''hsl()'' function is extended as follows:
@@ -1117,6 +1141,8 @@ the allowed [=channel keywords=] are:
11171141
lightseagreen is hsl(177deg 70% 41%), so --complement is <span class="swatch" style="--color: hsl(357deg 70% 41%)"></span> hsl(357deg 70% 41%)
11181142
</div>
11191143

1144+
Relative color syntax is only applicable to the non-legacy HSL syntactic forms.
1145+
11201146
<h3 id="relative-HWB">Relative HWB colors</h3>
11211147

11221148
The grammar of the ''hwb()'' function is extended as follows:

0 commit comments

Comments
 (0)