Skip to content

Commit 311174c

Browse files
author
Litherum
committed
[fonts-4] @font-palette-values uses illegal integer descriptor names
#1523
1 parent 3009d53 commit 311174c

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

css-fonts-4/Overview.bs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3403,8 +3403,8 @@ The ''@font-palette-values'' rule accepts the descriptors defined in this specif
34033403
@font-palette-values Augusta {
34043404
font-family: Handover Sans;
34053405
base-palette: 3;
3406-
1: rgb(43, 12, 9);
3407-
3: var(--highlight);
3406+
color-1: rgb(43, 12, 9);
3407+
color-3: var(--highlight);
34083408
}
34093409
</pre>
34103410
</div>
@@ -3501,10 +3501,10 @@ Colors can be added to the color palette
35013501
by using the <<integer>> descriptor in the ''@font-palette-values'' rule.
35023502

35033503
<h3 id="palette-integer-desc">
3504-
Overriding a color in the palette: The <<integer>> descriptor</h3>
3504+
Overriding a color in the palette: The 'color-<<integer>>' descriptors</h3>
35053505

35063506
<pre class='descdef'>
3507-
Name: <<integer>>
3507+
Name: color-<<integer>>
35083508
Value: <<color>>
35093509
For: @font-palette-values
35103510
Initial: N/A
@@ -3524,13 +3524,29 @@ Otherwise, a new color is added to this color palette at the index of this descr
35243524
<pre>
35253525
@font-palette-values Augusta {
35263526
font-family: Handover Sans;
3527-
1: rgb(43, 12, 9);
3528-
2: rgb(208, 112, 96);
3529-
3: var(--highlight);
3527+
color-1: rgb(43, 12, 9);
3528+
color-2: rgb(208, 112, 96);
3529+
color-3: var(--highlight);
35303530
}
35313531
</pre>
35323532
</div>
35333533

3534+
The parsing rules for these descriptors are as follows:
3535+
3536+
1. The descriptor must start with the string "color-".
3537+
3538+
2. If there is nothing remaining in the string, it is a parse failure.
3539+
3540+
3. Otherwise, if the next character is a 0, the presence of anything after the 0 results in a parse failure.
3541+
3542+
4. Otherwise, if the next character is a non-zero digit (1 through 9), the remainder of the string must be digits.
3543+
3544+
5. Otherwise, it is a parse failure.
3545+
3546+
Using these rules, the non-negative integers prefixed with "color-" are valid identifiers.
3547+
3548+
These descriptors are zero-indexed, so the initial palette in the font is represented by the <code>color-0</code> descriptor.
3549+
35343550
Using CSS Variables is explicitly expected to be valid in the value of this descriptor.
35353551
Using CSS Variables is disallowed in the key of this descriptor.
35363552
CSS Variables are resolved in the context of the element to which the 'font-palette' property applies.

0 commit comments

Comments
 (0)