@tenphi/glaze 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +161 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -28
- package/dist/index.d.mts +40 -28
- package/dist/index.mjs +161 -141
- package/dist/index.mjs.map +1 -1
- package/docs/api.md +1 -9
- package/docs/migration.md +1 -1
- package/docs/okhst.md +1 -9
- package/package.json +5 -2
package/docs/api.md
CHANGED
|
@@ -404,7 +404,7 @@ Every input form defaults to `mode: 'auto'` so the resolved token adapts between
|
|
|
404
404
|
|
|
405
405
|
- **Value-shorthand** (bare strings, value objects, and `{ from, ...overrides }`):
|
|
406
406
|
- Light variant preserves the input tone exactly (`lightTone: false`).
|
|
407
|
-
- All other config fields (`darkTone`, `darkDesaturation`, `
|
|
407
|
+
- All other config fields (`darkTone`, `darkDesaturation`, `autoFlip`) snapshot from `globalConfig` at create time.
|
|
408
408
|
- **Structured input** (`{ hue, saturation, tone, ... }`):
|
|
409
409
|
- Both tone windows snapshot from `globalConfig` at create time (same as a theme color).
|
|
410
410
|
- All fields are **snapshotted at color-creation time** — later `glaze.configure()` calls don't retroactively change existing tokens.
|
|
@@ -450,7 +450,6 @@ The optional `config` second argument (`GlazeConfigOverride`) overrides the reso
|
|
|
450
450
|
| `lightTone` | `[10, 100]` | Light tone window: `[lo, hi]`, `{ lo, hi, eps }`, or `false` (disable clamping). |
|
|
451
451
|
| `darkTone` | `[15, 95]` | Dark tone window: `[lo, hi]`, `{ lo, hi, eps }`, or `false` (disable clamping). |
|
|
452
452
|
| `darkDesaturation` | `0.1` | Saturation reduction in dark scheme (0–1). |
|
|
453
|
-
| `saturationTaper` | `0.15` | Saturation taper strength toward the tone extremes (0–1). |
|
|
454
453
|
| `autoFlip` | `true` | Default for each color's `flip`: when solving `contrast` (or applying a relative `tone` that overshoots), allow crossing to the opposite side instead of clamping. |
|
|
455
454
|
| `shadowTuning` | `undefined` | Default shadow tuning (meaningful for themes; harmless on color tokens). |
|
|
456
455
|
|
|
@@ -989,10 +988,6 @@ S_dark = S_light * (1 - darkDesaturation) // default: 0.1
|
|
|
989
988
|
|
|
990
989
|
`static` mode skips desaturation.
|
|
991
990
|
|
|
992
|
-
### Saturation taper
|
|
993
|
-
|
|
994
|
-
`saturationTaper` (default `0.15`) gently reduces saturation toward the tone extremes, where in-gamut chroma collapses. It is the *strength* (0–1) — the maximum fraction of saturation removed at the very edges — ramped in smoothly over the outer ~15% of tone on each end. Mid-tones are untouched; `0` disables it.
|
|
995
|
-
|
|
996
991
|
---
|
|
997
992
|
|
|
998
993
|
## Configuration
|
|
@@ -1002,7 +997,6 @@ glaze.configure({
|
|
|
1002
997
|
lightTone: [10, 100], // [lo, hi]; or { lo, hi, eps } / false to disable clamping
|
|
1003
998
|
darkTone: [15, 95], // [lo, hi]; or { lo, hi, eps } / false to disable clamping
|
|
1004
999
|
darkDesaturation: 0.1,
|
|
1005
|
-
saturationTaper: 0.15,
|
|
1006
1000
|
states: {
|
|
1007
1001
|
dark: '@dark',
|
|
1008
1002
|
highContrast: '@high-contrast',
|
|
@@ -1027,7 +1021,6 @@ A `ToneWindow` is `[lo, hi]` (OKHSL-lightness endpoints, reference eps — the c
|
|
|
1027
1021
|
| `lightTone` | `[10, 100]` | Light scheme tone window: `[lo, hi]`, `{ lo, hi, eps }`, or `false` to disable clamping. Bypassed in HC. |
|
|
1028
1022
|
| `darkTone` | `[15, 95]` | Dark scheme tone window: `[lo, hi]`, `{ lo, hi, eps }`, or `false` to disable clamping. Bypassed in HC. |
|
|
1029
1023
|
| `darkDesaturation` | `0.1` | Saturation reduction in dark scheme (0–1). |
|
|
1030
|
-
| `saturationTaper` | `0.15` | Saturation taper strength toward the tone extremes (0–1). `0` disables. |
|
|
1031
1024
|
| `states.dark` | `'@dark'` | State alias for dark mode tokens (Tasty export). |
|
|
1032
1025
|
| `states.highContrast` | `'@high-contrast'` | State alias for HC tokens. |
|
|
1033
1026
|
| `modes.dark` | `true` | Include dark variants in exports. |
|
|
@@ -1210,6 +1203,5 @@ import {
|
|
|
1210
1203
|
| `maxIterations` | `18` | Max binary-search iterations per branch. |
|
|
1211
1204
|
| `initialDirection` | higher-contrast side | Direction to search first (`'lighter'` or `'darker'`). |
|
|
1212
1205
|
| `flip` | `false` | When `true`, try the opposite direction if the initial one doesn't meet the target. When `false`, only the initial direction is searched — unmet contrasts pin the result to that direction's extreme. |
|
|
1213
|
-
| `saturationTaper` | `0` | When `> 0`, candidate saturation rolls off toward the tone extremes (same envelope the renderer applies), so the solved tone meets the floor at its rendered saturation. |
|
|
1214
1206
|
|
|
1215
1207
|
Result: `{ tone, contrast, met, branch: 'lighter' | 'darker' | 'preferred', flipped? }`. `flipped: true` indicates the initial direction failed and the opposite direction satisfied the target.
|
package/docs/migration.md
CHANGED
|
@@ -34,7 +34,7 @@ glaze.configure({ lightLightness: [10, 100], darkLightness: [15, 95], darkCurve:
|
|
|
34
34
|
glaze.configure({
|
|
35
35
|
lightTone: [10, 100],
|
|
36
36
|
darkTone: [15, 95],
|
|
37
|
-
// darkCurve removed
|
|
37
|
+
// darkCurve removed
|
|
38
38
|
});
|
|
39
39
|
```
|
|
40
40
|
|
package/docs/okhst.md
CHANGED
|
@@ -155,19 +155,11 @@ A window is authored as `[lo, hi]` (reference eps — the common form),
|
|
|
155
155
|
to disable clamping. `false` is the full range `[0, 100]` at the reference eps —
|
|
156
156
|
it removes the **boundaries**, not the tone curve.
|
|
157
157
|
|
|
158
|
-
Other defaults: `darkDesaturation = 0.1` (unchanged),
|
|
158
|
+
Other defaults: `darkDesaturation = 0.1` (unchanged),
|
|
159
159
|
`autoFlip = true`.
|
|
160
160
|
|
|
161
161
|
Reference: `REF_EPS = 0.05`.
|
|
162
162
|
|
|
163
|
-
## Saturation taper
|
|
164
|
-
|
|
165
|
-
At the tone extremes the in-gamut chroma collapses, so high saturation near
|
|
166
|
-
white/black reads as noise. `saturationEnvelope(s, toneFinal, taper)` applies a
|
|
167
|
-
smoothstep rolloff over the outer `taper` fraction of the tone range (default
|
|
168
|
-
`0.15` → outer 15% on each end). `taper = 0` disables it. It is conservative by
|
|
169
|
-
design: mid-tones are untouched, so existing ramps barely shift.
|
|
170
|
-
|
|
171
163
|
## Contrast metric (unified)
|
|
172
164
|
|
|
173
165
|
`contrast` is a single prop with a pluggable metric:
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenphi/glaze",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.15.0",
|
|
4
|
+
"description": "OKHST-based color theme generator with WCAG contrast solving for light, dark, and high-contrast schemes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"keywords": [
|
|
34
34
|
"color",
|
|
35
35
|
"theme",
|
|
36
|
+
"okhst",
|
|
36
37
|
"okhsl",
|
|
37
38
|
"contrast",
|
|
38
39
|
"wcag",
|
|
@@ -57,10 +58,12 @@
|
|
|
57
58
|
"tsdown": "^0.20.3",
|
|
58
59
|
"typescript": "^5.9.3",
|
|
59
60
|
"typescript-eslint": "^8.56.0",
|
|
61
|
+
"vite": "^8.0.16",
|
|
60
62
|
"vitest": "^4.0.18"
|
|
61
63
|
},
|
|
62
64
|
"scripts": {
|
|
63
65
|
"build": "tsdown",
|
|
66
|
+
"playground": "vite playground",
|
|
64
67
|
"test": "vitest run",
|
|
65
68
|
"test:watch": "vitest",
|
|
66
69
|
"test:coverage": "vitest run --coverage",
|