style-dictionary-utils
Version:
Utilities to use in your style dictionary config
15 lines (14 loc) • 385 B
JavaScript
import { toHex } from 'color2k';
import { isColor } from '../filter/isColor.js';
import { getValue } from '../utilities/getValue.js';
/**
* colorToHex
* @description convert a token of type `color` to a hex value
*/
export const colorToHex = {
name: 'color/hex',
type: `value`,
transitive: true,
filter: isColor,
transform: (token) => toHex(getValue(token)),
};