parsers icon indicating copy to clipboard operation
parsers copied to clipboard

Color Formatting

Open kristiandavid opened this issue 3 years ago • 1 comments

I noticed that when I try using to-scss-variables or to-css-custom-properties the color formatting isn't working for border types. Works fine for color token types however.

For example, the following:

{
      "name": "Design Tokens / Borders - CSS",
      "path": "./output/styles/borders.css",
      "filter": {
        "types": [
          "border"
        ]
      },
      "parsers": [
        {
          "name": "sort-by",
          "options": {
            "keys": [
              "name"
            ]
          }
        },
        {
          "name": "to-css-custom-properties",
          "options": {
            "formatName": "kebabCase",
            "formatTokens": {
              "color": "hex"
            }
          }
        }
      ]
    }

outputs as:

--border-grey-100: 1px solid rgba(242, 242, 242, 1);

I'd prefer it to output a hex color value, is that doable?

kristiandavid avatar Feb 01 '23 21:02 kristiandavid

Hi @kristiandavid, good suggestion 👍 Feel free to open a PR. Otherwise, we will do it when we will have the bandwidth.

AMoreaux avatar Feb 02 '23 15:02 AMoreaux