UNPKG

@tokens-studio/graph-engine

Version:

An execution engine to handle Token Studios generators and resolvers

33 lines 803 B
import Color from 'colorjs.io'; export const toColor = (color) => { const colorInstance = new Color(color.space, color.channels, color.alpha); return colorInstance; }; export const toColorObject = (color) => { return { space: color.space.id, channels: color.coords, alpha: color.alpha }; }; export const toHex = (color) => color.to('srgb').toString({ format: 'hex' }); export const hexToColor = (hex) => { return toColorObject(new Color(hex)); }; export const Black = { space: 'srgb', channels: [0, 0, 0] }; export const White = { space: 'srgb', channels: [1, 1, 1] }; export const Gray = { space: 'srgb', channels: [0.5, 0.5, 0.5] }; export const Red = { space: 'srgb', channels: [1, 0, 0] }; //# sourceMappingURL=utils.js.map