Skip to content

Commit e424cd1

Browse files
committed
fix: use valid CSS color space names in toValue()
colorjs uses internal short names (p3, a98rgb, prophoto) that don't match the CSS predefined color space identifiers required by the spec: - p3 → display-p3 - a98rgb → a98-rgb - prophoto → prophoto-rgb This caused toValue() to emit invalid CSS like `color(p3 ...)`, which the css-tree lexer rejects when re-validating the value in the CSS value input (e.g. after a round-trip through the style panel).
1 parent a0eafdc commit e424cd1

2 files changed

Lines changed: 1 addition & 2 deletions

File tree

packages/css-engine/src/core/to-value.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ describe("Convert WS CSS Values to native CSS strings", () => {
446446
expect(value).toBe(expected);
447447
});
448448
}
449-
});
450449

451450
test("color in tuple", () => {
452451
const value = toValue({

packages/css-engine/src/core/to-value.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export const toValue = (
122122
case "oklch":
123123
return `oklch(${c1} ${c2} ${c3} / ${alpha})`;
124124
// Fall back to color() function for less common color spaces.
125-
// colorjs uses internal short names that differ from CSS predefined color space identifiers.
125+
// Webstudio uses colorjs internal names; map to CSS predefined color space names.
126126
case "p3":
127127
return `color(display-p3 ${c1} ${c2} ${c3} / ${alpha})`;
128128
case "a98rgb":

0 commit comments

Comments
 (0)