Skip to content

Commit 19c8d49

Browse files
committed
Add support for CSS Color HDR
1 parent 3e143a0 commit 19c8d49

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

lib/properties/definitions.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2720,6 +2720,18 @@ module.exports = {
27202720
},
27212721
value: 'auto | text-bottom | alphabetic | ideographic | middle | central | mathematical | hanging | text-top',
27222722
},
2723+
'dynamic-range-limit': {
2724+
initial: {
2725+
parsed: {
2726+
end: 8,
2727+
start: 0,
2728+
types: ['<ident-token>', '<ident>', '<keyword>', 'dynamic-range-limit'],
2729+
value: 'no-limit',
2730+
},
2731+
serialized: 'no-limit',
2732+
},
2733+
value: 'standard | no-limit | constrained-high | <dynamic-range-limit-mix()>',
2734+
},
27232735
'empty-cells': {
27242736
initial: {
27252737
parsed: {

lib/values/definitions.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module.exports = {
7373
'<color-stop>': '<color-stop-length> | <color-stop-angle>',
7474
'<color-stripe>': '<color> && [<length-percentage> | <flex>]?',
7575
'<color>': '<color-base> | currentColor | <system-color> | <contrast-color()> | <device-cmyk()> | <light-dark()>',
76-
'<colorspace-params>': '<custom-params> | <predefined-rgb-params> | <xyz-params>',
76+
'<colorspace-params>': '<custom-params> | <predefined-rgb-params> | <predefined-polar-params> | <predefined-rectangular-params> | <xyz-params>',
7777
'<combinator>': "'>' | '+' | '~' | '|' '|'",
7878
'<command-end-point>': 'to <position> | by <coordinate-pair>',
7979
'<common-lig-values>': 'common-ligatures | no-common-ligatures',
@@ -152,6 +152,7 @@ module.exports = {
152152
'<display-listitem>': '<display-outside>? && [flow | flow-root]? && list-item',
153153
'<display-outside>': 'block | inline | run-in',
154154
'<drop-shadow()>': 'drop-shadow(<color>? && <length>{2,3})',
155+
'<dynamic-range-limit-mix()>': "dynamic-range-limit-mix([<'dynamic-range-limit'> && <percentage [0,100]>]#{2,∞})",
155156
'<easing-function>': '<linear-easing-function> | <cubic-bezier-easing-function> | <step-easing-function>',
156157
'<east-asian-variant-values>': 'jis78 | jis83 | jis90 | jis04 | simplified | traditional',
157158
'<east-asian-width-values>': 'full-width | proportional-width',
@@ -196,6 +197,7 @@ module.exports = {
196197
'<gradient>': '<linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()> | <repeating-conic-gradient()>',
197198
'<grayscale()>': 'grayscale([<number> | <percentage>]?)',
198199
'<grid-line>': 'auto | <custom-ident> | [<integer [-∞,-1]> | <integer [1,∞]>] && <custom-ident>? | span && [<integer [1,∞]> || <custom-ident>]',
200+
'<hdr-color()>': 'color-hdr([<color> && <number [0,∞]>?]#{2})',
199201
'<hex-color>': '<hash-token>',
200202
'<historical-lig-values>': 'historical-ligatures | no-historical-ligatures',
201203
'<horizontal-line-command>': 'hline [to [<length-percentage> | left | center | right | x-start | x-end] | by <length-percentage>]',
@@ -337,8 +339,11 @@ module.exports = {
337339
'<position-two>': '[left | center | right | x-start | x-end] && [top | center | bottom | y-start | y-end] | [left | center | right | x-start | x-end | <length-percentage>] [top | center | bottom | y-start | y-end | <length-percentage>] | [block-start | center | block-end] && [inline-start | center | inline-end] | [start | center | end]{2}',
338340
'<position>': '<position-one> | <position-two> | <position-four>',
339341
'<pow()>': 'pow(<calc-sum> , <calc-sum>)',
342+
'<predefined-polar-params>': 'jzczhz [<number> | <percentage> | none]{2} [<hue> | none]',
343+
'<predefined-rectangular-params>': '<predefined-rectangular> [<number> | <percentage> | none]{3}',
344+
'<predefined-rectangular>': 'jzazbz | ictcp',
340345
'<predefined-rgb-params>': '<predefined-rgb> [<number> | <percentage> | none]{3}',
341-
'<predefined-rgb>': 'srgb | srgb-linear | display-p3 | a98-rgb | prophoto-rgb | rec2020',
346+
'<predefined-rgb>': 'srgb | srgb-linear | display-p3 | a98-rgb | prophoto-rgb | rec2020 | rec2100-pq | rec2100-hlg | rec2100-linear',
342347
'<progress()>': 'progress(<calc-sum> , <calc-sum> , <calc-sum>)',
343348
'<progress>': "[<calc-sum> | <'animation-timeline'>] && [by <easing-function>]?",
344349
'<pseudo-class-selector>': ': <ident-token> | : <function-token> <any-value> )',

scripts/extract.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,6 @@ const excluded = {
487487
specifications: [
488488
// Not ready
489489
'css-color-6',
490-
'css-color-hdr',
491490
'css-conditional-values',
492491
'css-gaps',
493492
'css-grid-3',
@@ -565,6 +564,16 @@ const excluded = {
565564
// https://github.com/w3c/csswg-drafts/issues/1981
566565
'<element()>',
567566
],
567+
'css-color': [
568+
// Prefer CSS Color HDR
569+
'<colorspace-params>',
570+
'<predefined-rgb>',
571+
],
572+
'css-color-5': [
573+
// Prefer CSS Color HDR
574+
'<colorspace-params>',
575+
'<predefined-rgb>',
576+
],
568577
'css-images': [
569578
// TODO: fix parsing/serializing `<radial-gradient-syntax>`, `<radial-size>`
570579
'<radial-extent>',

0 commit comments

Comments
 (0)