You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const{ coords, id }=deserialize(colorStr);// coords: any, id: any
BTW its is not very convenient, that id returns lowercase color space instead of keyof typeof import("@texel/color") like "OKLCH" | "OKLab" | "sRGB" | "OKLab_to" ... because i try to use it like:
const{ coords, id }=deserialize(color)...constconvertedColor=convert(coords,colorSpace[id]// cant just use id here, have to write additional logic to convert srgb => sRGB, oklch => OKLCH etc.colorSpace[targetSpace]);
The text was updated successfully, but these errors were encountered:
The string is an alias, mostly to match with CSS spec (for example ‘display-p3’ for color serialization, which would be a very awkward identifier name for the color space).
For now, you’ll have to use listColorSpaces().find(c => c.id === id) to find the actual color space object from the string id.
The serialization API could be improved; I’m open to ideas as to how it could look. The goal would be to do it in a way that doesn’t bloat bundle size for all users of the library.
The string is an alias, mostly to match with CSS spec (for example ‘display-p3’ for color serialization, which would be a very awkward identifier name for the color space).
For now, you’ll have to use listColorSpaces().find(c => c.id === id) to find the actual color space object from the string id.
The serialization API could be improved; I’m open to ideas as to how it could look. The goal would be to do it in a way that doesn’t bloat bundle size for all users of the library.
BTW its is not very convenient, that
id
returns lowercase color space instead ofkeyof typeof import("@texel/color")
like"OKLCH" | "OKLab" | "sRGB" | "OKLab_to" ...
because i try to use it like:The text was updated successfully, but these errors were encountered: