For the complete documentation index, see llms.txt. This page is also available as Markdown.

convert-color

This parser helps you convert color formats of color tokens.

Interface

interface parser {
  name: 'convert-color';
  options: {
    toFormat:
      | 'hex'
      | 'rgb'
      | 'hsl'
      | 'hsb'
      | 'lch'
      | 'lab';
    applyTo?:
      | { collection: string | true }
      | { group: string | true }
      | { token: string | true }
      | SDTFQuery;
  };
}

Options

Parameter
Required
Type
Default
Description

toFormat

required

The target color format to convert to. Actual value conversion is done by the colord package.

applyTo

optional

The selection where to apply the transformation. collection, group, token take a Regex string or true to select anything of the kind. An SDTFQuery can be used for advance use cases. Learn more about how to query your SDTF graph.

Basic usage

We convert all colors from our SDTF graph in hsl.

We then generate our transformed SDTF graph in a JSON file thanks to the to-sdtf parser.

Last updated

Was this helpful?