UNPKG

@tokens-studio/graph-engine

Version:

An execution engine to handle Token Studios generators and resolvers

24 lines 836 B
import { ColorSchema, StringSchema } from '../../schemas/index.js'; import { Node } from '../../programmatic/node.js'; import { toColorObject } from './lib/utils.js'; import Color from 'colorjs.io'; export { ColorModifierTypes } from '@tokens-studio/types'; export default class NodeDefinition extends Node { static title = 'String to Color'; static type = 'studio.tokens.color.strToColor'; static description = 'Parses a string to a color'; constructor(props) { super(props); this.addInput('color', { type: StringSchema }); this.addOutput('color', { type: ColorSchema }); } execute() { const { color } = this.getAllInputs(); this.outputs.color.set(toColorObject(new Color(color))); } } //# sourceMappingURL=stringToColor.js.map