GamutDesk Logo
GamutDesk

W3C Design Tokens (DTCG) JSON Generator

Generate W3C Design Tokens Community Group JSON for colors with $value and $type. Name up to 12 tokens and copy a spec-shaped file for Style Dictionary.

Client-Side ArchitecturePrivate Client-Side Processing

Colors (5/12)

Output

DTCG JSON (tokens.json)
{
  "color": {
    "$type": "color",
    "primary": {
      "$value": "#2563EB"
    },
    "secondary": {
      "$value": "#7C3AED"
    },
    "success": {
      "$value": "#16A34A"
    },
    "warning": {
      "$value": "#F59E0B"
    },
    "surface": {
      "$value": "#F8FAFC"
    }
  }
}

Technical Specification & Mathematical Principles

How the Design Tokens Export (DTCG JSON) Works

The Design Tokens Community Group format stores each token as an object with a $value and a $type. For colors the type is "color" and the value is a hex string such as "#3B82F6". Tokens are nested in groups, and a $type placed on a group is inherited by every token inside it.

This generator emits one group containing your named colors. Token names are lowercased, special characters become hyphens and duplicates receive numeric suffixes, because names must not contain dots, braces or start with a dollar sign.

Frequently Asked Questions

Is this the final W3C specification?
The DTCG format is a community group draft that tools such as Style Dictionary and Tokens Studio already support. The hex string value form used here is accepted by those tools.
What is the difference between $value and value?
The dollar prefix is part of the DTCG spec so that reserved keys can never clash with token names. Older formats use plain value and type.
How do I use the JSON in Style Dictionary?
Save it as a .tokens.json file and add it to your source array. Style Dictionary 4 reads the $value and $type keys natively.

Related Design & Color Instruments