Skip to content

Commit eaab736

Browse files
fantasaisvgeesus
authored andcommitted
[css-color-4] Factor out <alpha-value> into its own section.
1 parent 44fa726 commit eaab736

File tree

1 file changed

+39
-17
lines changed

1 file changed

+39
-17
lines changed

css-color-4/Overview.bs

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,29 @@ Legacy Comma-separated Color Function Syntax</h4>
760760
where there is no Web compatibility issue,
761761
the <a>legacy color syntax</a> is invalid.
762762

763+
<h3 id="alpha-syntax">
764+
Representing Transparency: the <<alpha-value>> syntax</h3>
765+
766+
<pre class="prod">
767+
<dfn>&lt;alpha-value></dfn> = <<number>> | <<percentage>>
768+
</pre>
769+
770+
Opacity in CSS is typically represented using the <<alpha-value>> syntax,
771+
for example in the 'opacity' property
772+
or as the [=alpha component=] in a [=color function=].
773+
Represented as a <<number>>, the useful range of the value is ''0''
774+
(representing full transparency)
775+
to ''1''
776+
(representing full opacity).
777+
It can also be written as a <<percentage>>,
778+
which [=computed value|computes to=]
779+
the equivalent <<number>>
780+
(''0%'' to ''0'', ''100%'' to ''1'').
781+
Unless otherwise specified,
782+
an <<alpha-value>> component defaults to ''100%'' when omitted.
783+
Values outside the range [0,1] are not invalid,
784+
but are clamped to that range when [=computed value|computed=].
785+
763786
<h3 id="hue-syntax">
764787
Representing Cylindrical-coordinate Hues: the <<hue>> syntax</h3>
765788

@@ -1685,7 +1708,6 @@ The RGB functions: ''rgb()'' and ''rgba()''</h3>
16851708
<pre class='prod'>
16861709
<dfn>rgb()</dfn> = rgb( [<<percentage>> | none]{3} [ / [<<alpha-value>> | none] ]? ) |
16871710
rgb( [<<number>> | none]{3} [ / [<<alpha-value>> | none] ]? )
1688-
<dfn>&lt;alpha-value></dfn> = <<number>> | <<percentage>>
16891711
</pre>
16901712

16911713
<wpt>
@@ -1714,12 +1736,6 @@ The RGB functions: ''rgb()'' and ''rgba()''</h3>
17141736
If this is not possible, the channel should be <a href="https://drafts.csswg.org/css-values-4/#combine-integers">rounded towards +∞</a>.
17151737

17161738
The final argument, the <<alpha-value>>, specifies the alpha of the color.
1717-
If given as a <<number>>, the useful range of the value is ''0''
1718-
(representing a fully transparent color)
1719-
to ''1''
1720-
(representing a fully opaque color).
1721-
If given as a <<percentage>>, ''0%'' represents a fully transparent color,
1722-
while ''100%'' represents a fully opaque color.
17231739
If omitted, it defaults to ''100%''.
17241740

17251741
<wpt>
@@ -3654,9 +3670,9 @@ Specifying Lab and LCH: the ''lab()'' and ''lch()'' functional notations</h3>
36543670
and theoretically unbounded
36553671
(but in practice do not exceed ±160).
36563672

3657-
There is an optional fourth alpha value,
3673+
There is an optional fourth <<alpha-value>> component,
36583674
separated by a slash,
3659-
and interpreted identically to the <<alpha-value>> in ''rgb()''.
3675+
representing the [=alpha component=].
36603676

36613677
If the lightness of a Lab color is ''0%'',
36623678
both the a and b components are [=powerless=].
@@ -3730,9 +3746,9 @@ Specifying Lab and LCH: the ''lab()'' and ''lch()'' functional notations</h3>
37303746
''180deg'' points along the negative "a" axis (toward greenish cyan),
37313747
and ''270deg'' points along the negative "b" axis (toward sky blue).
37323748

3733-
There is an optional fourth alpha value,
3749+
There is an optional fourth <<alpha-value>> component,
37343750
separated by a slash,
3735-
and interpreted identically to the <<alpha-value>> in ''rgb()''.
3751+
representing the [=alpha component=].
37363752

37373753
If the chroma of an LCH color is ''0%'',
37383754
the hue component is [=powerless=].
@@ -3818,9 +3834,9 @@ Specifying Lab and LCH: the ''lab()'' and ''lch()'' functional notations</h3>
38183834
and theoretically unbounded
38193835
(but in practice do not exceed ±0.5).
38203836

3821-
There is an optional fourth alpha value,
3837+
There is an optional fourth <<alpha-value>> component,
38223838
separated by a slash,
3823-
and interpreted identically to the <<alpha-value>> in ''rgb()''.
3839+
representing the [=alpha component=].
38243840

38253841
If the lightness of an OKLab color is ''0%'',
38263842
both the a and b components are [=powerless=].
@@ -3891,9 +3907,9 @@ Specifying Lab and LCH: the ''lab()'' and ''lch()'' functional notations</h3>
38913907
''180deg'' points along the negative "a" axis (toward greenish cyan),
38923908
and ''270deg'' points along the negative "b" axis (toward sky blue).
38933909

3894-
There is an optional fourth alpha value,
3910+
There is an optional fourth <<alpha-value>> component,
38953911
separated by a slash,
3896-
and interpreted identically to the <<alpha-value>> in ''rgb()''.
3912+
representing the [=alpha component=].
38973913

38983914
If the chroma of an OKLCH color is ''0%'',
38993915
the hue component is [=powerless=].
@@ -4072,8 +4088,6 @@ Specifying Predefined Colors: the ''color()'' function</h3>
40724088

40734089

40744090
* An optional slash-separated <<alpha-value>>.
4075-
This is interpreted the same way as the <<alpha-value>> in ''rgb()'',
4076-
and if omitted it defaults to ''100%''.
40774091

40784092
<wpt>
40794093
parsing/color-valid.html
@@ -6108,6 +6122,14 @@ parsing/relative-color-valid.html
61086122
<h2 id='changes' class='no-num'>
61096123
Changes</h2>
61106124

6125+
<h3 id="changes-from-20220705">Changes since the
6126+
<a href="https://www.w3.org/TR/2022/CR-css-color-4-20220705/">Candidate Recommendation of 5 July 2022</a>
6127+
</h3>
6128+
6129+
<ul>
6130+
<li>Editorial refactoring.
6131+
</ul>
6132+
61116133
<h3 id="changes-from-20220628">Changes since the
61126134
<a href="https://www.w3.org/TR/2022/WD-css-color-4-20220628/">Working Draft of 28 June 2022</a>
61136135
</h3>

0 commit comments

Comments
 (0)