Skip to content

Commit 3e739ad

Browse files
committed
[css-color-4] Specify RGB channels using reference ranges rather than prose, for consistency
1 parent 6ef5bbe commit 3e739ad

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

css-color-4/Overview.bs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,8 @@ sRGB Colors</h2>
11431143
<h3 id='rgb-functions'>
11441144
The RGB functions: ''rgb()'' and ''rgba()''</h3>
11451145

1146-
The ''rgb()'' and ''rgba()'' functions define an sRGB color by specifying the red, green, and blue channels directly.
1146+
The ''rgb()'' and ''rgba()'' functions define an sRGB color
1147+
by specifying the r, g and b (red, green, and blue) channels directly.
11471148
Their syntax is:
11481149

11491150
<pre class='prod'>
@@ -1161,6 +1162,20 @@ The RGB functions: ''rgb()'' and ''rgba()''</h3>
11611162
[ / [<<alpha-value>> | none] ]? )
11621163
</pre>
11631164

1165+
<table id="prr-srgb">
1166+
<tr>
1167+
<th>Percentages</th>
1168+
<td>Allowed for r, g and b</td>
1169+
</tr>
1170+
<tr>
1171+
<th>Percent reference range&nbsp;</th>
1172+
<td>
1173+
For r, g and b: 0% = 0.0, 100% = 255.0
1174+
For alpha: 0% = 0.0, 100% = 1.0
1175+
</td>
1176+
</tr>
1177+
</table>
1178+
11641179
<wpt>
11651180
rgb-001.html
11661181
rgb-002.html
@@ -1176,14 +1191,13 @@ The RGB functions: ''rgb()'' and ''rgba()''</h3>
11761191
parsing/color-valid-rgb.html
11771192
</wpt>
11781193

1179-
The first three arguments specify the red, green, and blue channels of the color, respectively.
1194+
The first three arguments specify the r, g and b (red, green, and blue)
1195+
channels of the color, respectively.
11801196
''0%'' represents the minimum value for that color channel in the sRGB gamut,
11811197
and ''100%'' represents the maximum value.
1182-
A <<number>> is equivalent to a <<percentage>>,
1183-
but with a different range:
1184-
''0'' again represents the minimum value for the color channel,
1185-
but ''255'' represents the maximum.
1186-
These values come from the fact that many graphics engines store the color channels internally as a single byte,
1198+
1199+
The [=percentage reference range=] of the color channels comes from the historical fact that
1200+
many graphics engines stored the color channels internally as a single byte,
11871201
which can hold integers between 0 and 255.
11881202
Implementations should honor the precision of the channel as authored or calculated wherever possible.
11891203
If this is not possible, the channel should be <a href="https://drafts.csswg.org/css-values-4/#combine-integers">rounded towards +∞</a>.

0 commit comments

Comments
 (0)