@designtools/tokens 0.7.0 → 0.7.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  Notable changes to `@designtools/tokens`. Dates are release dates; versions follow semver, with breaking changes in the minor slot while the package is pre-1.0.
4
4
 
5
+ ## 0.7.1
6
+
7
+ ### Patch Changes
8
+
9
+ - 637fc1f: Light muted sits a step under the canvas: still neutral-100 under the default canvas, but neutral-50 under a page given lighter than neutral-25 (`--canvas "#FFFFFF"`), where 100 read heavy.
10
+ - 55d3d36: Hover and press on a fill too near white to lighten (a pale yellow under black text) now darken it instead, rather than turning it white.
11
+
5
12
  ## 0.7.0
6
13
 
7
14
  ### Minor Changes
@@ -554,7 +554,9 @@ var ACTIVE_SHIFT = 0.15;
554
554
  function stateOf(fill, label, shift, gamut) {
555
555
  const f = parseToOklch(fill);
556
556
  const labelIsLight = getContrastRatio(label, "#000000") > getContrastRatio(label, "#ffffff");
557
- const l = Math.min(1, Math.max(0, f.l + (labelIsLight ? -shift : shift)));
557
+ const away = labelIsLight ? -shift : shift;
558
+ const room = away > 0 ? 1 - f.l : f.l;
559
+ const l = Math.min(1, Math.max(0, f.l + (room >= shift ? away : -away)));
558
560
  return formatOklchInGamut(l, f.c ?? 0, f.h ?? 0, gamut);
559
561
  }
560
562
  function chromaOf(color) {
@@ -681,7 +683,9 @@ function generateSemanticTokens(palette, mode, options, gamuts = { own: "srgb" }
681
683
  }
682
684
  } : {}
683
685
  });
684
- const mutedBg = snapShade(mode === "light" ? 100 : 800, activeShades);
686
+ const canvas = pageGrounds[0];
687
+ const whitePage = mode === "light" && !!canvas && parseToOklch(canvas).l > parseToOklch(neutral[snapShade(25, activeShades)]).l + 5e-3;
688
+ const mutedBg = snapShade(mode === "light" ? whitePage ? 50 : 100 : 800, activeShades);
685
689
  const mutedFg = accessibleStep(
686
690
  neutral,
687
691
  mode === "light" ? 500 : 200,
package/dist/cli.js CHANGED
@@ -33,7 +33,7 @@ import {
33
33
  tokenFamilies,
34
34
  usageReport,
35
35
  withJsonProvenance
36
- } from "./chunk-43GMBZQK.js";
36
+ } from "./chunk-L73RTEAG.js";
37
37
 
38
38
  // src/cli.ts
39
39
  import { parseArgs } from "util";
package/dist/index.js CHANGED
@@ -66,7 +66,7 @@ import {
66
66
  tokenFamilies,
67
67
  usageReport,
68
68
  withJsonProvenance
69
- } from "./chunk-43GMBZQK.js";
69
+ } from "./chunk-L73RTEAG.js";
70
70
  export {
71
71
  ALIAS_PAIRS,
72
72
  APCAUnavailableError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designtools/tokens",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Turn one brand colour into a complete design-token system: perceptual OKLCH ramps, contrast-checked semantic tokens (WCAG or APCA), light and dark, as CSS custom properties, Tailwind v4/v3 or DTCG. Deterministic CLI, safe for agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",