Repository navigation
Description
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.yamlreferencestype: Colorincomponent_sub_tokensbut never defines whatColormeansspec.mdxhas the Color definition as a static paragraph (line 46)- If someone reads only
spec-config.yamlto 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
- Feature request: alpha channels and modern color spaces (OKLCH/P3) #53: The Color type definition was just updated in PR docs: update color spec to document all supported CSS color formats #96 to document all supported CSS color formats. That change was made directly in the mdx template because there was no other mechanism.
Activity
feat: data-driven Color and Dimension type definitions (fixes google-…
feat: data-driven Color and Dimension type definitions (fixes google-…
feat: data-driven Color and Dimension type definitions (fixes #97) (#117
feat: data-driven Color and Dimension type definitions (fixes google-…