Registry
A

color-token-to-hex-object-json

No description available

alexbit-codemod0 executions

  • Legacy
  • design tokens
npx codemod color-token-to-hex-object-json

In JSON files, for tokens of the type 'color' (not other tokens), transform $value into an object with a 'hex' key, where the value remains the same as the previous $value

Before

json
{
  "interactive": {
    "100": {
      "$value": "<some string>",
      "$type": "color"
    }
  },
  "someOtherColorToken": {
    "$value": "#DBF0FF",
    "$type": "color"
  }
}

After

json
{
  "interactive": {
    "100": {
      "$value": {
        "hex": "<some string>"
      },
      "$type": "color"
    }
  },
  "someOtherColorToken": {
    "$value": {
      "hex": "#DBF0FF"
    },
    "$type": "color"
  }
}

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.