@tenphi/glaze 0.15.0 → 0.15.1

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/docs/api.md CHANGED
@@ -219,6 +219,7 @@ type ColorDef = RegularColorDef | ShadowColorDef | MixColorDef;
219
219
  | `mode` | `'auto' \| 'fixed' \| 'static'` | Adaptation mode. Default: `'auto'`. See [Adaptation modes](#adaptation-modes). |
220
220
  | `flip` | `boolean` | Flip out-of-bounds results (relative `tone` overshoot / unmet `contrast`) to the opposite side instead of clamping. Default: the global `autoFlip` (`true`). See [`flip`](#flip). |
221
221
  | `opacity` | `number` | Fixed alpha 0–1. Output includes alpha in the CSS value. Combining with `contrast` is not recommended (a `console.warn` is emitted). |
222
+ | `pastel` | `boolean` | Per-color override for the hue-independent "safe" chroma limit used in OKHSL↔sRGB conversions (luminance, contrast solving, output formatting). Falls through to the global / per-theme `pastel` config when omitted. Default: unset. See [Per-color `pastel`](#per-color-pastel). |
222
223
  | `inherit` | `boolean` | Whether this color is inherited by child themes via `extend()`. Default: `true`. Set to `false` to make the color local to the current theme. |
223
224
 
224
225
  #### Tone values
@@ -299,6 +300,38 @@ theme.colors({
299
300
 
300
301
  Relative hue is always relative to the **theme seed hue**, not to a base color.
301
302
 
303
+ #### Per-color `pastel`
304
+
305
+ `pastel: true` on a single color def overrides the global / per-theme `pastel` config for that color only. It toggles the hue-independent "safe" chroma limit used in every OKHSL↔sRGB conversion that touches this color: luminance calculations during contrast solving, gamut clamping during sRGB blend / mix edges, and output formatting. The effective flag is carried on the resolved variant (`ResolvedColorVariant.pastel`) so formatting matches the gamut mapping applied during resolution.
306
+
307
+ ```ts
308
+ const theme = glaze(280, 80);
309
+ theme.colors({
310
+ plain: { tone: 50, saturation: 1 },
311
+ soft: { tone: 50, saturation: 1, pastel: true },
312
+ });
313
+ // theme.resolve().get('soft')!.light.pastel === true
314
+ // theme.css().light contains different rgb() triples for `--plain` and `--soft`
315
+ ```
316
+
317
+ Omit the field to inherit the global / per-theme `pastel` config — useful for keeping the default behavior while opting a single accent into the pastel gamut.
318
+
319
+ The flag is part of the def object, so `extend()` copies it through to child themes alongside the rest of the def. Override it again on the child to flip a single color back:
320
+
321
+ ```ts
322
+ const parent = glaze(280, 80);
323
+ parent.colors({ soft: { tone: 50, saturation: 1, pastel: true } });
324
+
325
+ const child = parent.extend({
326
+ colors: { soft: { tone: 50, saturation: 1, pastel: false } },
327
+ });
328
+ // child.resolve().get('soft')!.light.pastel === false
329
+ ```
330
+
331
+ > **Note:** Per-color `pastel` is also supported on `ShadowColorDef` and `MixColorDef` (see the tables above). For shadows the math itself happens in OKHSL space, so the flag mainly controls the gamut-mapped output formatting and any luminance verification for that variant.
332
+ >
333
+ > Standalone `glaze.color()` tokens accept the same `pastel` field on both the structured (`GlazeColorInput`) and value-shorthand (`GlazeColorOverrides`) forms, and it survives the `export()` / `glaze.colorFrom()` round-trip.
334
+
302
335
  ### `ShadowColorDef`
303
336
 
304
337
  | Field | Type | Description |
@@ -308,6 +341,7 @@ Relative hue is always relative to the **theme seed hue**, not to a base color.
308
341
  | `fg` | `string` | Optional foreground color name for tinting and intensity modulation. Must reference a non-shadow color. Omit for an achromatic shadow at full user-specified intensity. |
309
342
  | `intensity` | `HCPair<number>` | Shadow intensity, 0–100. Supports HC pairs. |
310
343
  | `tuning` | `ShadowTuning` | Per-color tuning overrides. Merged field-by-field with the global `shadowTuning`. |
344
+ | `pastel` | `boolean` | Per-color `pastel` override. See [Per-color `pastel`](#per-color-pastel). |
311
345
  | `inherit` | `boolean` | Inheritance flag, default `true`. |
312
346
 
313
347
  See [Shadows](#shadows) below for the algorithm and tuning details.
@@ -323,6 +357,7 @@ See [Shadows](#shadows) below for the algorithm and tuning details.
323
357
  | `blend` | `'opaque' \| 'transparent'` | Default `'opaque'`. |
324
358
  | `space` | `'okhsl' \| 'srgb'` | Interpolation space for opaque blending. Default `'okhsl'`. Ignored for `'transparent'` (always composites in linear sRGB). |
325
359
  | `contrast` | `HCPair<ContrastSpec>` | Optional contrast floor against `base` (WCAG or APCA — see [`contrast`](#contrast-floor)). The solver adjusts the mix ratio (opaque) or opacity (transparent). |
360
+ | `pastel` | `boolean` | Per-color `pastel` override. See [Per-color `pastel`](#per-color-pastel). |
326
361
  | `inherit` | `boolean` | Inheritance flag, default `true`. |
327
362
 
328
363
  See [Mix colors](#mix-colors) below.
@@ -378,6 +413,7 @@ glaze.color(color: GlazeFromInput | GlazeColorInput | GlazeColorValue, config?:
378
413
  | `opacity` | `number` | Fixed alpha 0–1. |
379
414
  | `base` | `GlazeColorToken \| GlazeColorValue` | Optional dependency. See [Pairing colors](#pairing-colors). |
380
415
  | `contrast` | `HCPair<ContrastSpec>` | Contrast floor against `base` (WCAG or APCA). Without `base`, anchored to the literal seed. |
416
+ | `pastel` | `boolean` | Per-color `pastel` override. Falls through to the global / per-theme `pastel` config when omitted. See [Per-color `pastel`](#per-color-pastel). |
381
417
  | `name` | `string` | Debug label for warnings; doesn't change output keys. Reserved names (`'value'`, `'seed'`, `'externalBase'`) are rejected. |
382
418
 
383
419
  `GlazeFromInput` (from form) is `{ from: GlazeColorValue, ...colorOverrides }`:
@@ -394,6 +430,7 @@ glaze.color(color: GlazeFromInput | GlazeColorInput | GlazeColorValue, config?:
394
430
  | `contrast` | Contrast floor (WCAG or APCA). Without `base`, anchored to the literal seed; with `base`, solved per scheme. |
395
431
  | `base` | `GlazeColorToken` or raw `GlazeColorValue`. See [Pairing colors](#pairing-colors). |
396
432
  | `opacity` | Fixed alpha 0–1. Combining with `contrast` is not recommended — `console.warn` is emitted. |
433
+ | `pastel` | Per-color `pastel` override. Falls through to the global / per-theme `pastel` config when omitted. See [Per-color `pastel`](#per-color-pastel). |
397
434
  | `name` | Debug label only — surfaces in warnings/errors. Does not change output keys. |
398
435
 
399
436
  Named CSS colors (`'red'`, `'blueviolet'`) are not supported.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenphi/glaze",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
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",
@@ -64,6 +64,7 @@
64
64
  "scripts": {
65
65
  "build": "tsdown",
66
66
  "playground": "vite playground",
67
+ "build:playground": "vite build playground",
67
68
  "test": "vitest run",
68
69
  "test:watch": "vitest",
69
70
  "test:coverage": "vitest run --coverage",