Skip to content

Color type definition is not driven by spec-config.yaml #97

@davideast

Description

@davideast

The spec-config.yaml header says:

This file is the single source of truth for the DESIGN.md format specification.

But the Color type definition is hardcoded as prose in spec.mdx, not derived from the yaml config. This means spec-config.yaml is the source of truth for sections, units, typography properties, component sub-tokens, and recommended token names, but not for what a Color actually is.

The typography properties are fully data-driven from the yaml (typography_properties list), and the spec generator renders them dynamically. The Color type definition should follow the same pattern.

Current state

  • spec-config.yaml references type: Color in component_sub_tokens but never defines what Color means
  • spec.mdx has the Color definition as a static paragraph (line 46)
  • If someone reads only spec-config.yaml to understand the spec, they would not know what color formats are accepted

Suggestion

Add a types section to spec-config.yaml that defines the primitive types (Color, Dimension, etc.) with their descriptions and accepted formats. Then update the spec generator to render these type definitions from the config instead of hardcoding them in the mdx template.

Something like:

types:
  Color:
    description: "A color value is any valid CSS color string."
    formats:
      - "Hex: #RGB, #RGBA, #RRGGBB, #RRGGBBAA"
      - "Named colors: red, cornflowerblue, transparent"
      - "Functional: rgb(), rgba(), hsl(), hsla(), hwb()"
      - "Wide-gamut: oklch(), oklab(), lch(), lab()"
      - "Mixing: color-mix(in srgb, ...)"
    note: "All color values are internally converted to sRGB for WCAG contrast checking."
  Dimension:
    description: "A dimension value is a string with a unit suffix."
    units: [px, em, rem]

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions