Repository navigation
v0.13.0
Minor Changes
-
#61
43be630Thanks @tenphi! - Redesignglaze.color()input API and add per-instance config overrides.Breaking:
glaze.color()arg layout changedThe old two-overload signature (
value, overrides?, scaling?/structured, scaling?) is replaced by a single unified signature:glaze.color(color, config?)
color(arg 1): four shapes discriminated by structure:- Bare string →
glaze.color('#26fcb2') - Value object →
glaze.color({ h: 152, s: 0.95, l: 0.74 }) - New
{ from, ...overrides }→glaze.color({ from: '#fff', base: bg, contrast: 'AA' }) - Structured →
glaze.color({ hue: 152, saturation: 95, lightness: 74 })
- Bare string →
config(arg 2, optional):GlazeConfigOverride— overrides resolve-relevant config fields for this token only.
Migration
// Before glaze.color('#fff', { base: bg, contrast: 'AA' }); glaze.color('#fff', undefined, { darkLightness: false }); glaze.color('#fff', { opacity: 0.5 }, { lightLightness: false }); // After glaze.color({ from: '#fff', base: bg, contrast: 'AA' }); glaze.color('#fff', { darkLightness: false }); glaze.color({ from: '#fff', opacity: 0.5 }, { lightLightness: false });
New: per-instance config override (
GlazeConfigOverride)- Applies to both
glaze.color()andglaze()themes (second arg). - Fields:
lightLightness,darkLightness,darkDesaturation,darkCurve,autoFlip,shadowTuning. falsefor a lightness window disables clamping globally (= [0, 100]). Now accepted everywhere:configure(), per-token, and per-theme.- Token config is snapshotted at creation. Theme config merges over the live global at resolve time (non-overridden fields still react to
configure()). extend({ config })inherits and merges parent + child overrides.theme.export()/glaze.from()round-trip the config.
New:
{ from }form for value colors with overridesPass a raw color value alongside color overrides in one object:
const text = glaze.color({ from: '#1a1a2e', base: bg, contrast: 'AA' });
New: full-range base conversion
When a value/
fromcolor links to abasecreated via the structured form, the contrast/lightness anchor uses the raw input lightness (not the windowed output). This ensures accurate anchoring without affecting the base's own resolved output.Breaking: removed
GlazeColorScalingGlazeColorScalingis removed and replaced byGlazeConfigOverride. Scaling was limited to lightness windows; the new type covers the full resolve-relevant config.