Skip to content

Commit 1feacd9

Browse files
committed
Add support for the display-p3-linear color space
1 parent 3b65fa7 commit 1feacd9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/src/protofier.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ export class Protofier {
262262
case 'srgb':
263263
case 'srgb-linear':
264264
case 'display-p3':
265+
case 'display-p3-linear':
265266
case 'a98-rgb':
266267
case 'prophoto-rgb':
267268
case 'rec2020':

lib/src/value/color.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type ChannelNameLch = 'lightness' | 'chroma' | 'hue' | 'alpha';
4545
type ColorSpaceRgb =
4646
| 'a98-rgb'
4747
| 'display-p3'
48+
| 'display-p3-linear'
4849
| 'prophoto-rgb'
4950
| 'rec2020'
5051
| 'rgb'
@@ -154,6 +155,8 @@ function encodeSpaceForColorJs(space?: KnownColorSpace): string | undefined {
154155
return 'a98rgb';
155156
case 'display-p3':
156157
return 'p3';
158+
case 'display-p3-linear':
159+
return 'p3-linear';
157160
case 'prophoto-rgb':
158161
return 'prophoto';
159162
}
@@ -182,6 +185,8 @@ function decodeSpaceFromColorJs(space: string, isRgb = false): KnownColorSpace {
182185
return 'a98-rgb';
183186
case 'p3':
184187
return 'display-p3';
188+
case 'p3-linear':
189+
return 'display-p3-linear';
185190
case 'prophoto':
186191
return 'prophoto-rgb';
187192
}
@@ -216,6 +221,7 @@ function validateChannelInSpace(
216221
case 'srgb':
217222
case 'srgb-linear':
218223
case 'display-p3':
224+
case 'display-p3-linear':
219225
case 'a98-rgb':
220226
case 'prophoto-rgb':
221227
case 'rec2020':
@@ -382,6 +388,7 @@ export class SassColor extends Value {
382388
case 'srgb':
383389
case 'srgb-linear':
384390
case 'display-p3':
391+
case 'display-p3-linear':
385392
case 'a98-rgb':
386393
case 'prophoto-rgb':
387394
case 'rec2020':
@@ -482,6 +489,7 @@ export class SassColor extends Value {
482489

483490
case 'srgb-linear':
484491
case 'display-p3':
492+
case 'display-p3-linear':
485493
case 'a98-rgb':
486494
case 'prophoto-rgb':
487495
case 'rec2020':
@@ -1029,6 +1037,7 @@ export class SassColor extends Value {
10291037

10301038
case 'a98-rgb':
10311039
case 'display-p3':
1040+
case 'display-p3-linear':
10321041
case 'prophoto-rgb':
10331042
case 'rec2020':
10341043
case 'srgb':

0 commit comments

Comments
 (0)