v0.138.0
Minor Changes
-
#1145
20424549Thanks @tenphi! - Color system: migrate to@tenphi/glazeand add built-in dark + high-contrast schemes.The color palette is now generated by Glaze (OKHSL-based, contrast-aware) and emits three variants per token — light, dark, and high-contrast — wired through tasty's state aliases (
@dark,@hc). Schemes activate fromdata-schema="dark" | "light"anddata-contrast="more" | "less"on<html>, withprefers-color-scheme/prefers-contrastmedia-query fallbacks, so apps that opt in get adaptive theming with no per-component changes.- New surface tokens:
#surface,#surface-2,#surface-3for backgrounds;#surface-text,#surface-text-soft,#surface-text-soft-2,#surface-2-text,#surface-2-text-soft,#surface-3-text,#surface-3-text-softfor text. The darkest text tokens are anchored at the bottom of Glaze's lightness window so they match the legacy#dark(OKHSL L≈12) in light mode and invert cleanly in dark/HC. - New per-theme accent tokens:
#primary-accent-surface,#primary-accent-text,#primary-accent-text-soft,#primary-accent-icon,#primary-accent-surface-hover,#primary-accent-surface-2/3, plus matchingsuccess-*/danger-*/warning-*/note-*(andpurple-*as a primary alias). Used by buttons, banners, tags, etc. The*-text-softvariants (#primary-text-soft,#danger-text-soft, …) are adaptive (mode auto) at AA-floor contrast (cr 4.5/7) — the right anchor for a less-prominent foreground that still meets AA in BOTH light and dark schemes (used as the LINK base color, with*-texttaking over on hover). - Other new tokens:
#border,#focus,#placeholder,#disabled,#disabled-surface,#disabled-surface-text,#overlay,#shadow-sm/#shadow-md/#shadow-lg, and#surface-inverse(fixed-mode "always dark" surface for tooltips and other elements that intentionally don't invert).#disabled-surfaceand#disabled-surface-textare adaptive contrast-driven tokens (cr ≈ 1.4 / 2.0 vs#surface) so the disabled state has perceptually identical "washed-out" look in light, dark, and HC schemes — replacing legacy#dark.04/#dark-04/#white.6patterns that became too contrasty in dark mode. - PrismCode theme: a new
#code-*palette (code-comment,code-punctuation,code-keyword,code-string,code-number,code-function,code-attribute) with WCAG AA contrast against#surfacein every scheme; diff insertion / deletion reuse#success-*/#danger-*. - Backward compatibility: every legacy color token (
#dark,#dark-01…#dark-05,#text,#minor,#shadow,#light,#dark-bg,#primary,#primary-text,#primary-bg,#primary-icon,#primary-hover,#primary-desaturated,#primary-disabled,#purple-01…#purple-04, the full#danger-*/#success-*/#warning-*/#note-*families,#disabled-surface-text,#disabled-surface,#focus,#pink,#clear) keeps working and now adapts to dark/HC for free via the underlying Glaze tokens. - Removed:
#whiteand#blackas explicit token definitions — they are tasty built-ins and resolve automatically. The Storybook Playground story was removed (use the dedicated playground). - Storybook helpers:
withDarkScheme()andwithHighContrast()decorators insrc/stories/decorators/withColorScheme.tsxfor previewing components in alternate schemes. - Dependencies: adds
@tenphi/glaze; updates@tenphi/tastyto a build that emitsdata-schema/data-contrastpredefined states; updates Storybook to10.3.6.
Existing apps and components keep rendering identically in light mode (legacy aliases preserve current colors). To opt into dark mode, set
<html data-schema="dark">(or rely on the user's system preference). Apps using hardcoded#whiteas a "page background" should switch to#surfaceso the body adapts with the scheme. - New surface tokens: