Skip to content

feat(color): value-shorthand inputs, base+contrast overrides, css() e…#50

Merged
tenphi merged 2 commits into
mainfrom
feat/color-value-shorthand
May 8, 2026
Merged

feat(color): value-shorthand inputs, base+contrast overrides, css() e…#50
tenphi merged 2 commits into
mainfrom
feat/color-value-shorthand

Conversation

@tenphi
Copy link
Copy Markdown
Owner

@tenphi tenphi commented May 7, 2026

…xport

Accept hex, rgb()/hsl()/okhsl()/oklch(), OkhslColor, and [r,g,b] tuples as the first arg of glaze.color(). Optional overrides add base (any value form), contrast, and relative hue/lightness. Adds .css({ name }) for full export parity with theme.css().

…xport

Accept hex, rgb()/hsl()/okhsl()/oklch(), OkhslColor, and [r,g,b] tuples
as the first arg of glaze.color(). Optional overrides add base (any value
form), contrast, and relative hue/lightness. Adds .css({ name }) for full
export parity with theme.css().

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

📦 Snapshot release

Published 0.0.0-snapshot.0821a67.

pnpm add @tenphi/glaze@0.0.0-snapshot.0821a67

…math helpers

- Snapshot lightLightness/darkLightness from globalConfig at create time
  for object/tuple/structured inputs (matches existing string-input
  behavior); token.export() now round-trips byte-for-byte across
  glaze.configure() calls regardless of input form.
- Validate structured GlazeColorInput up front: hue (finite),
  saturation/lightness (0-100, including HC-pair components),
  saturationFactor (0-1), opacity (0-1). Out-of-range inputs fail with
  a helpful error instead of producing NaN-laden tokens.
- Reject empty / whitespace-only name overrides.
- Re-export oklabToOkhsl and parseHexAlpha from the package root for
  parity with parseHex / okhslToOklab.
- Extract CONTRAST_WARN_SLACK constant with a @see reference to
  contrast-solver.ts for the solver overshoot it pairs with.
- Fix README "Defaults" prose: structured form preserves light input
  exactly (was incorrectly described as remapping via lightLightness).

Co-authored-by: Cursor <cursoragent@cursor.com>
@tenphi tenphi merged commit 6e2d42d into main May 8, 2026
3 checks passed
@github-actions github-actions Bot mentioned this pull request May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant