Repository navigation
v0.16.0
Minor Changes
-
#69
86c3d27Thanks @tenphi! - Add opt-in DTCG Resolver-Module export (dtcgResolver())- New export.
theme.dtcgResolver(),palette.dtcgResolver(), andglaze.color().dtcgResolver()emit a single W3C DTCG Resolver-Module document describing every scheme variant in one file —sets(the light tokens as the default source) plus a singleschememodifier with a context per variant (light/dark/lightContrast/darkContrast) and aresolutionOrder. An alternative todtcg()'s per-scheme files for resolver tools such as Dispersa. - Why one modifier. Glaze resolves
darkContrastindependently (it is notdark+lightContrastlayered), so the four-context shape keeps every resolved value exact. Two independent modifiers would compose additively and produce wrong dark + high-contrast values. - Options.
GlazeDtcgResolverOptionsextendsGlazeDtcgOptions(modes+colorSpacepass through) withsetName(default'base'),modifierName(default'scheme'),contextNames(rename the four contexts), andversion(default'2025.10'). Standaloneglaze.color().dtcgResolver()requiresname. - New public types:
GlazeDtcgResolverDocument,GlazeDtcgResolverOptions,GlazeColorDtcgResolverOptions,DtcgTokenTree,DtcgResolverSet,DtcgResolverModifier,DtcgResolverRef.
- New export.
-
#69
86c3d27Thanks @tenphi! - Add DTCG and Tailwind CSS v4 token exportsdtcg()— W3C Design Tokens Format Module (2025.10) export. Available on themes, palettes, and standaloneglaze.color()tokens. Returns one spec-conformant token document per scheme variant (light/dark/lightContrast/darkContrast``), each a{ name: { $type: 'color', $value } }tree consumable by Figma, Tokens Studio, Style Dictionary v4+, Terrazzo, Penpot, and every DTCG-compatible tool. ThecolorSpaceoption selects the$valuerepresentation:'srgb'(default — gamma sRGBcomponentsin 0–1 plus ahexhint) or'oklch'(Glaze-native, wide-gamut[L, C, H], no hex).alpha` is emitted only when opacity is below 1. One document per scheme is the most tool-compatible convention (one file per Style Dictionary theme / Tokens Studio set / Figma variable mode).tailwind()— Tailwind CSS v4 export. Returns a single ready-to-paste CSS string: an@themeblock (light baseline) plus dark / high-contrast overrides under configurable selectors. The--color-*namespace (configurable vianamespace) auto-generatesbg-*/text-*/border-*utilities.darkSelector(default.dark) accepts an at-rule like'@media (prefers-color-scheme: dark)'(nests:rootautomatically);highContrastSelector(default.high-contrast) covers the HC variants, with the combined block at${darkSelector}${highContrastSelector}. Defaultformatis'oklch'.- New types exported from the package entry:
DtcgColorSpace,DtcgSrgbColorValue,DtcgOklchColorValue,DtcgColorValue,DtcgColorToken,DtcgDocument,GlazeDtcgResult,GlazeColorDtcgResult,GlazeDtcgOptions,GlazeTailwindOptions,GlazeColorTailwindOptions. - New color-math helpers exported for advanced use:
srgbToHex(rgb)(sRGB 0–1 →#rrggbb) andokhslToOklch(h, s, l, pastel?)(OKHSL →[L, C, H]), shared byformatOklchand the DTCG exporter. - Both new exports honor
modes(dark / high-contrast gating) and the paletteprefix/primaryoptions. Onpalette.tailwind(), the palette theme-prefixprefixis separate fromGlazeTailwindOptions.namespace(the--color-*CSS namespace).
-
#69
86c3d27Thanks @tenphi! - feat+breaking: oklch hue channel splitting (pastel-only); add okhst tasty-only output; okhsl/okhst are tasty-only; tokens/json default to oklch- Add
splitHueoncss()/tasty()(theme + palette) and standalonecolor.css()— emits hue as a separate custom property referenced viavar()inoklchvalues. Requires every exported color to be pastel. - Add
'okhst'output format (okhst(H S% T%)) for Tasty exports. okhslandokhstthrow on non-Tasty exports (css,tailwind,tokens,json).tokens()/json()default format changes fromokhsltooklch(theme, palette, standalone.json()).
- Add
-
#69
86c3d27Thanks @tenphi! - Add semantic color roles with APCA polarity and APCA presets- Roles. Colors now carry a semantic
role('text'|'surface'|'border', with aliases likebg/fg/divider/outline/fill/ink/…). The role fixes APCA contrast polarity — which side is the foreground vs the background — so the APCA solver uses the correct argument order instead of always treating the resolved color as text. WCAG is symmetric and unaffected. - Role inference. Roles are inferred from the color name by default (
inferRole: true), with the last recognized token winning (button-text→text,input-bg→surface,card-outline→border). When a name doesn't infer, the opposite of the base's role is used; otherwise the color defaults totext(foreground), preserving previous behavior. Setglaze.configure({ inferRole: false })to opt out of name inference. - APCA presets. APCA targets accept named Bronze Simple Mode presets:
'preferred'(Lc 90),'body'(75),'content'(60, ~AA),'large'(45, ~3:1),'non-text'(30),'min'(15). Use anywhere an APCA target is accepted, e.g.contrast: { apca: 'content' }orcontrast: { apca: ['content', 'body'] }. Presets are role-independent. roleis also available onMixColorDefand standaloneglaze.color()inputs and survives theexport()/glaze.colorFrom()round-trip.
- Roles. Colors now carry a semantic