Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/src/protofier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export class Protofier {
case 'srgb':
case 'srgb-linear':
case 'display-p3':
case 'display-p3-linear':
case 'a98-rgb':
case 'prophoto-rgb':
case 'rec2020':
Expand Down
9 changes: 9 additions & 0 deletions lib/src/value/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type ChannelNameLch = 'lightness' | 'chroma' | 'hue' | 'alpha';
type ColorSpaceRgb =
| 'a98-rgb'
| 'display-p3'
| 'display-p3-linear'
| 'prophoto-rgb'
| 'rec2020'
| 'rgb'
Expand Down Expand Up @@ -154,6 +155,8 @@ function encodeSpaceForColorJs(space?: KnownColorSpace): string | undefined {
return 'a98rgb';
case 'display-p3':
return 'p3';
case 'display-p3-linear':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Do we have exhaustive checks enabled in eslint?

It doesn't seem like we do so explicitly, it's not enabled by default by eslint, and I couldn't tell whether gts enabled it 🤔

If not, it may be a good idea to do so, or at the very least to have a const _never: never = value in a default case for the compiler to warn about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we do have them enabled.

return 'p3-linear';
case 'prophoto-rgb':
return 'prophoto';
}
Expand Down Expand Up @@ -182,6 +185,8 @@ function decodeSpaceFromColorJs(space: string, isRgb = false): KnownColorSpace {
return 'a98-rgb';
case 'p3':
return 'display-p3';
case 'p3-linear':
return 'display-p3-linear';
case 'prophoto':
return 'prophoto-rgb';
}
Expand Down Expand Up @@ -216,6 +221,7 @@ function validateChannelInSpace(
case 'srgb':
case 'srgb-linear':
case 'display-p3':
case 'display-p3-linear':
case 'a98-rgb':
case 'prophoto-rgb':
case 'rec2020':
Expand Down Expand Up @@ -382,6 +388,7 @@ export class SassColor extends Value {
case 'srgb':
case 'srgb-linear':
case 'display-p3':
case 'display-p3-linear':
case 'a98-rgb':
case 'prophoto-rgb':
case 'rec2020':
Expand Down Expand Up @@ -482,6 +489,7 @@ export class SassColor extends Value {

case 'srgb-linear':
case 'display-p3':
case 'display-p3-linear':
case 'a98-rgb':
case 'prophoto-rgb':
case 'rec2020':
Expand Down Expand Up @@ -1029,6 +1037,7 @@ export class SassColor extends Value {

case 'a98-rgb':
case 'display-p3':
case 'display-p3-linear':
case 'prophoto-rgb':
case 'rec2020':
case 'srgb':
Expand Down