hextimator 0.14.3 → 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/dist/react.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  hextimate
3
- } from "./chunk-FEOOTCAG.js";
4
- import "./chunk-23UBW2KU.js";
3
+ } from "./chunk-3JIC7LRE.js";
4
+ import "./chunk-Q6KJLMLM.js";
5
5
 
6
6
  // src/react/hextimator-provider.tsx
7
7
  import {
@@ -144,6 +144,7 @@ import { useRef } from "react";
144
144
  function useStableOptions(options) {
145
145
  const ref = useRef(options);
146
146
  const serialized = JSON.stringify({
147
+ theme: options?.theme,
147
148
  style: options?.style,
148
149
  presets: options?.presets,
149
150
  format: options?.format,
@@ -151,6 +152,7 @@ function useStableOptions(options) {
151
152
  cssPrefix: options?.cssPrefix
152
153
  });
153
154
  if (serialized !== JSON.stringify({
155
+ theme: ref.current?.theme,
154
156
  style: ref.current?.style,
155
157
  presets: ref.current?.presets,
156
158
  format: ref.current?.format,
@@ -170,6 +172,7 @@ function HextimatorProvider({
170
172
  onColorChange,
171
173
  defaultMode: initialMode = "system",
172
174
  onModePreferenceChange,
175
+ theme,
173
176
  style: initialStyle,
174
177
  presets: initialPresets,
175
178
  format: formatOpts,
@@ -233,6 +236,7 @@ function HextimatorProvider({
233
236
  []
234
237
  );
235
238
  const stable = useStableOptions({
239
+ theme,
236
240
  style,
237
241
  presets,
238
242
  format: formatOpts,
@@ -241,7 +245,7 @@ function HextimatorProvider({
241
245
  });
242
246
  const buildOne = useCallback(
243
247
  (c) => {
244
- const b = hextimate(c);
248
+ const b = hextimate(c, stable?.theme);
245
249
  if (stable?.style && Object.keys(stable.style).length > 0) {
246
250
  b.style(stable.style);
247
251
  }
@@ -249,7 +253,7 @@ function HextimatorProvider({
249
253
  configure?.(b);
250
254
  return b;
251
255
  },
252
- [stable?.style, presets, configure]
256
+ [stable?.theme, stable?.style, presets, configure]
253
257
  );
254
258
  const lightBuilder = useMemo(
255
259
  () => buildOne(lightColor),
@@ -356,6 +360,7 @@ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
356
360
  function HextimatorScope({
357
361
  defaultColor,
358
362
  isolated = false,
363
+ theme,
359
364
  style: initialStyle,
360
365
  presets: initialPresets,
361
366
  format: formatOpts,
@@ -396,6 +401,7 @@ function HextimatorScope({
396
401
  );
397
402
  const parent = useContext(HextimatorContext);
398
403
  const stable = useStableOptions({
404
+ theme,
399
405
  style,
400
406
  presets,
401
407
  format: formatOpts,
@@ -404,7 +410,7 @@ function HextimatorScope({
404
410
  });
405
411
  const buildOne = useCallback2(
406
412
  (c) => {
407
- const b = !isolated && parent?.builder ? parent.builder.fork(c) : hextimate(c);
413
+ const b = !isolated && !stable?.theme && parent?.builder ? parent.builder.fork(c) : hextimate(c, stable?.theme);
408
414
  if (stable?.style && Object.keys(stable.style).length > 0) {
409
415
  b.style(stable.style);
410
416
  }
@@ -412,7 +418,14 @@ function HextimatorScope({
412
418
  configure?.(b);
413
419
  return b;
414
420
  },
415
- [parent?.builder, isolated, stable?.style, presets, configure]
421
+ [
422
+ parent?.builder,
423
+ isolated,
424
+ stable?.theme,
425
+ stable?.style,
426
+ presets,
427
+ configure
428
+ ]
416
429
  );
417
430
  const lightBuilder = useMemo2(
418
431
  () => buildOne(lightColor),
@@ -506,6 +519,7 @@ import { useMemo as useMemo3 } from "react";
506
519
  import { jsx as jsx3 } from "react/jsx-runtime";
507
520
  function HextimatorStyle({
508
521
  color,
522
+ theme,
509
523
  style: styleOptions,
510
524
  presets,
511
525
  format: formatOpts,
@@ -515,6 +529,7 @@ function HextimatorStyle({
515
529
  selector
516
530
  }) {
517
531
  const stable = useStableOptions({
532
+ theme,
518
533
  style: styleOptions,
519
534
  presets,
520
535
  format: formatOpts,
@@ -522,7 +537,7 @@ function HextimatorStyle({
522
537
  cssPrefix
523
538
  });
524
539
  const css = useMemo3(() => {
525
- const builder = hextimate(color);
540
+ const builder = hextimate(color, stable?.theme);
526
541
  if (stable?.style && Object.keys(stable.style).length > 0) {
527
542
  builder.style(stable.style);
528
543
  }
@@ -550,7 +565,7 @@ function useHextimator(color, options) {
550
565
  const target = options?.target;
551
566
  const presets = stable?.presets;
552
567
  const palette = useMemo4(() => {
553
- const builder = hextimate(color);
568
+ const builder = hextimate(color, stable?.theme);
554
569
  if (stable?.style && Object.keys(stable.style).length > 0) {
555
570
  builder.style(stable.style);
556
571
  }
@@ -560,7 +575,7 @@ function useHextimator(color, options) {
560
575
  ...stable?.format,
561
576
  as: "object"
562
577
  });
563
- }, [color, stable?.style, presets, stable?.format, configure]);
578
+ }, [color, stable?.theme, stable?.style, presets, stable?.format, configure]);
564
579
  const darkMode = stable?.darkMode ?? { type: "media" };
565
580
  const cssPrefix = stable?.cssPrefix ?? "";
566
581
  useEffect3(() => {
package/fallback.css CHANGED
@@ -4,6 +4,10 @@
4
4
  --surface-weak: #ebebeb;
5
5
  --surface-foreground: #030303;
6
6
  --surface-foreground-weak: #525252;
7
+ --surface-foreground-accent: #4c4c4c;
8
+ --surface-foreground-positive: #4c4c4c;
9
+ --surface-foreground-negative: #4c4c4c;
10
+ --surface-foreground-caution: #4c4c4c;
7
11
  --accent: #454545;
8
12
  --accent-strong: #383838;
9
13
  --accent-weak: #525252;
@@ -34,6 +38,10 @@
34
38
  --surface-weak: #2e2e2e;
35
39
  --surface-foreground: #f5f5f5;
36
40
  --surface-foreground-weak: #a3a3a3;
41
+ --surface-foreground-accent: #bcbcbc;
42
+ --surface-foreground-positive: #bcbcbc;
43
+ --surface-foreground-negative: #bcbcbc;
44
+ --surface-foreground-caution: #bcbcbc;
37
45
  --accent: #454545;
38
46
  --accent-strong: #525252;
39
47
  --accent-weak: #2b2b2b;
@@ -64,6 +72,10 @@
64
72
  --surface-weak: #2e2e2e;
65
73
  --surface-foreground: #f5f5f5;
66
74
  --surface-foreground-weak: #a3a3a3;
75
+ --surface-foreground-accent: #bcbcbc;
76
+ --surface-foreground-positive: #bcbcbc;
77
+ --surface-foreground-negative: #bcbcbc;
78
+ --surface-foreground-caution: #bcbcbc;
67
79
  --accent: #454545;
68
80
  --accent-strong: #525252;
69
81
  --accent-weak: #2b2b2b;
package/llms.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  # hextimator
2
2
 
3
3
  > One brand color in. A complete, accessible light + dark theme out.
4
- > Use it programmatically (`hextimate(color)`) or via CLI (`npx hextimator`).
4
+ > Use it programmatically (`hextimate(color)` or `hextimate(color, theme)`) or via CLI (`npx hextimator`).
5
5
 
6
6
  Generates palettes in **OKLCH** for perceptually even contrast; outputs map to sRGB with gamut mapping. WCAG contrast targets are configurable (`AAA` default).
7
7
 
@@ -10,7 +10,7 @@ Generates palettes in **OKLCH** for perceptually even contrast; outputs map to s
10
10
  - **Got a color, want a stylesheet?** - CLI (section 1)
11
11
  - **Got a color, want JSON / programmatic access?** - Library (section 2)
12
12
  - **Building a React app?** - React (section 3)
13
- - **Need a specific framework's tokens?** - Presets (section 4)
13
+ - **Need custom roles, tokens, or a framework's tokens?** - Themes (section 4)
14
14
 
15
15
  ## 1. CLI
16
16
 
@@ -29,7 +29,7 @@ Quote hex colors in the shell (`'#6366f1'`).
29
29
  | `-p`, `--preset` | Preset name, **repeatable** in order (`muted` then `shadcn`, etc.) | - |
30
30
  | `-f`, `--format` | `css`, `object`, `tailwind`, `tailwind-css`, `scss`, `json` | `css` |
31
31
  | `-c`, `--colors` | `hex`, `rgb`, `hsl`, `oklch`, `p3` (+ `-raw` variants) | `hex` |
32
- | `-t`, `--theme` | `light`, `dark`, `both` (ignored for `css` / `tailwind-css`) | `both` |
32
+ | `-t`, `--theme` | `light`, `dark`, `both` | `both` |
33
33
  | `-o`, `--output` | Write file instead of stdout | stdout |
34
34
  | `--dark-mode` | `media`, `class`, `data-attribute`, `off` (stylesheet formats only) | `media` |
35
35
  | `--selector` | Root selector for CSS output | `:root` |
@@ -74,17 +74,15 @@ const tokens = hextimate("#6366f1").format();
74
74
  // { light: { accent, "accent-strong", ... }, dark: { ... } }
75
75
 
76
76
  const sheet = hextimate("#6366f1").format({ as: "css", colors: "oklch" });
77
+ const shadcn = hextimate("#6366f1", themes.shadcn).format();
77
78
  ```
78
79
 
79
- ### Builder (chainable)
80
+ `hextimate(color, theme?)` returns a builder. The theme (section 4) sets roles, tokens, and style.
81
+
82
+ ### Builder
80
83
 
81
84
  | Call | Role |
82
85
  |------|------|
83
- | `.preset(p)` | Apply preset(s); call multiple times, later wins on conflicts |
84
- | `.style(partial)` | Merge `HextimateStyleOptions` (contrast, surfaces, semantics, etc.) |
85
- | `.addRole(name, color)` | New role with default / strong / weak / foreground / foreground-weak |
86
- | `.addVariant(name, placement)` | Extra lightness step on every role |
87
- | `.addToken(name, value)` | Standalone derived token |
88
86
  | `.fork(color?)` | Clone for another brand / tenant |
89
87
  | `.simulate(cvdType, severity?)` | CVD preview |
90
88
  | `.adaptFor(cvdType, severity?)` | Optimize palette for a CVD type |
@@ -100,11 +98,13 @@ const sheet = hextimate("#6366f1").format({ as: "css", colors: "oklch" });
100
98
  | `tailwind-css` | Tailwind v4 `@theme` string |
101
99
  | `scss` / `json` | As named |
102
100
 
103
- `colors`, `darkMode` (`"media"` \| `"class"` \| `"data-attribute"` \| `false`), `selector`, `roleNames`, `variantNames`, `separator`, `keyPrefix`, `excludeRoles`, `excludeVariants` match the CLI conceptually.
101
+ `colors`, `theme` (`"light"` \| `"dark"` \| `"both"`), `darkMode` (`"media"` \| `"class"` \| `"data-attribute"` \| `false`), `selector`, `variantNames`, `separator`, `keyPrefix`, `excludeRoles`, `excludeVariants` match the CLI conceptually.
102
+
103
+ Deprecated but still working: `.preset()`, `.style()`, `.addRole()`, `.addVariant()`, `.addToken()`, `fromConfig()`, `format.roleNames`. Use a theme instead.
104
104
 
105
105
  ### Default token grid
106
106
 
107
- Roles: `surface`, `accent`, `positive`, `negative`, `caution`. Variants: default (no suffix), `strong`, `weak`, `foreground`, `foreground-weak` (softest text that still meets the contrast target vs DEFAULT). Plus `brand-exact` and `brand-exact-foreground`.
107
+ Roles: `surface`, `accent`, `positive`, `negative`, `caution`. Variants: default (no suffix), `strong`, `weak`, `foreground`, `foreground-weak` (softest text that still meets the contrast target vs DEFAULT). Surface also has `foreground-accent`, `foreground-positive`, `foreground-negative`, `foreground-caution`: role-colored text that meets the contrast target on surface DEFAULT, weak, and strong (`text-surface-foreground-negative` for errors on the page; `text-negative-foreground` for text on a negative fill). Plus `brand-exact` and `brand-exact-foreground`.
108
108
 
109
109
  ### Utilities
110
110
 
@@ -134,9 +134,35 @@ For app-wide state and palette switching: `HextimatorProvider`, `useHextimatorTh
134
134
 
135
135
  React options align with `.style()`, `.preset()` / `presets[]`, `.format()` (output is CSS variables).
136
136
 
137
- ## 4. Presets
137
+ ## 4. Themes
138
+
139
+ A `ThemeDefinition` is plain JSON-friendly data. `baseTheme` is the default. Extend by spreading; arrays and `roles` replace the whole field.
140
+
141
+ ```typescript
142
+ import { baseTheme, hextimate, type ThemeDefinition } from "hextimator";
143
+
144
+ const theme = {
145
+ ...baseTheme,
146
+ style: { minContrastRatio: "AA", surfaceHueShift: 160 },
147
+ roles: {
148
+ ...baseTheme.roles, // key = output name
149
+ cta: { color: "#ee2244" }, // fixed color
150
+ secondary: { from: "accent", hue: 180 }, // derived
151
+ },
152
+ variants: [{ name: "hover", placement: { from: "strong" } }],
153
+ tokens: [...baseTheme.tokens, { name: "ring", value: { from: "accent" } }],
154
+ variantNames: { foreground: "text" },
155
+ format: { as: "css", colors: "oklch" },
156
+ } satisfies ThemeDefinition;
157
+
158
+ hextimate("#6366f1", theme).format();
159
+ ```
160
+
161
+ Role generators: `surface` (at most one), `accent`, `positive`, `negative`, `caution`. Token generators: `brand-exact`, `brand-exact-foreground`. Applied in order: generated roles, other roles, variants, tokens.
162
+
163
+ ### Built-in themes
138
164
 
139
- Import: `import { hextimate, presets } from "hextimator"`.
165
+ Import: `import { hextimate, themes } from "hextimator"`.
140
166
 
141
167
  | Name | Kind | Notes |
142
168
  |------|------|--------|
@@ -148,10 +174,10 @@ Import: `import { hextimate, presets } from "hextimator"`.
148
174
  | `bold` | Style | Stronger accents, higher chroma on neutrals |
149
175
 
150
176
  ```typescript
151
- hextimate("#6366f1").preset(presets.muted).preset(presets.shadcn).format();
177
+ hextimate("#6366f1", { ...themes.shadcn, style: themes.muted.style }).format();
152
178
  ```
153
179
 
154
- Custom presets are plain objects (`style`, `roles`, `variants`, `tokens`, `format`); see repo docs linked below.
180
+ The CLI picks them by name (`--preset shadcn`). The React `presets` prop takes the matching `presets.*` objects.
155
181
 
156
182
  ## Tailwind CSS v4
157
183
 
@@ -160,7 +186,7 @@ Custom presets are plain objects (`style`, `roles`, `variants`, `tokens`, `forma
160
186
  @import "hextimator/tailwind.css";
161
187
  ```
162
188
 
163
- Registers utilities for built-in token names (`bg-accent`, etc.). Custom or preset-only names may need CLI-generated CSS.
189
+ Registers utilities for the default theme's names (`bg-accent`, etc.). For a custom theme, write `tailwindAliases(theme)` to a CSS file in a build script and import that instead.
164
190
 
165
191
  ## Fallback before JS
166
192
 
@@ -172,10 +198,8 @@ Neutral placeholders for **default** `hextimate()` variable names only. Does not
172
198
 
173
199
  ## Full reference (optional)
174
200
 
175
- - [Extending the palette](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/extending-the-palette.md)
176
- - [Customization (style & format)](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/customization.md)
177
- - [Multiple themes / fork](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/multiple-themes.md)
201
+ - [Themes](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/themes.md)
202
+ - [Built-in themes](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/presets.md)
178
203
  - [Color vision deficiency](https://github.com/fgrgic/hextimator/docs/color-vision-deficiency.md)
179
204
  - [React](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/react.md)
180
- - [Tailwind](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/tailwind.md)
181
205
  - [Examples](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/examples.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hextimator",
3
- "version": "0.14.3",
3
+ "version": "0.15.0",
4
4
  "description": "Runtime theming for multi-tenant apps.",
5
5
  "keywords": [
6
6
  "color-palette",
@@ -62,7 +62,7 @@
62
62
  "CHANGELOG.md"
63
63
  ],
64
64
  "scripts": {
65
- "build": "bun scripts/generate-fallback-css.ts && tsup",
65
+ "build": "bun scripts/generate-fallback-css.ts && bun scripts/generate-tailwind-css.ts && tsup",
66
66
  "dev": "tsup --watch",
67
67
  "generate:fallback": "bun scripts/generate-fallback-css.ts",
68
68
  "test": "bun test"
@@ -1,3 +1,4 @@
1
+ /* Generated by scripts/generate-tailwind-css.ts. Run bun run build:package to update. */
1
2
  @theme inline {
2
3
  --color-accent-inverted: var(--accent-inverted);
3
4
  --color-accent-strong-inverted: var(--accent-strong-inverted);
@@ -13,6 +14,18 @@
13
14
  --color-surface-foreground-weak-inverted: var(
14
15
  --surface-foreground-weak-inverted
15
16
  );
17
+ --color-surface-foreground-accent-inverted: var(
18
+ --surface-foreground-accent-inverted
19
+ );
20
+ --color-surface-foreground-positive-inverted: var(
21
+ --surface-foreground-positive-inverted
22
+ );
23
+ --color-surface-foreground-negative-inverted: var(
24
+ --surface-foreground-negative-inverted
25
+ );
26
+ --color-surface-foreground-caution-inverted: var(
27
+ --surface-foreground-caution-inverted
28
+ );
16
29
  --color-positive-inverted: var(--positive-inverted);
17
30
  --color-positive-strong-inverted: var(--positive-strong-inverted);
18
31
  --color-positive-weak-inverted: var(--positive-weak-inverted);
@@ -34,4 +47,8 @@
34
47
  --color-caution-foreground-weak-inverted: var(
35
48
  --caution-foreground-weak-inverted
36
49
  );
50
+ --color-brand-exact-inverted: var(--brand-exact-inverted);
51
+ --color-brand-exact-foreground-inverted: var(
52
+ --brand-exact-foreground-inverted
53
+ );
37
54
  }
package/tailwind.css CHANGED
@@ -1,3 +1,4 @@
1
+ /* Generated by scripts/generate-tailwind-css.ts. Run bun run build:package to update. */
1
2
  @theme inline {
2
3
  --color-accent: var(--accent);
3
4
  --color-accent-strong: var(--accent-strong);
@@ -9,6 +10,10 @@
9
10
  --color-surface-weak: var(--surface-weak);
10
11
  --color-surface-foreground: var(--surface-foreground);
11
12
  --color-surface-foreground-weak: var(--surface-foreground-weak);
13
+ --color-surface-foreground-accent: var(--surface-foreground-accent);
14
+ --color-surface-foreground-positive: var(--surface-foreground-positive);
15
+ --color-surface-foreground-negative: var(--surface-foreground-negative);
16
+ --color-surface-foreground-caution: var(--surface-foreground-caution);
12
17
  --color-positive: var(--positive);
13
18
  --color-positive-strong: var(--positive-strong);
14
19
  --color-positive-weak: var(--positive-weak);
@@ -1,184 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- // src/presets/index.ts
8
- var presets_exports = {};
9
- __export(presets_exports, {
10
- bold: () => bold,
11
- mui: () => mui,
12
- muted: () => muted,
13
- shadcn: () => shadcn,
14
- tinted: () => tinted,
15
- vibrant: () => vibrant
16
- });
17
-
18
- // src/presets/bold.ts
19
- var bold = {
20
- style: {
21
- light: { baseLightness: 0.5 },
22
- dark: { baseLightness: 0.8 },
23
- surfaceMaxChroma: 0.06,
24
- foregroundMaxChroma: 0.02
25
- }
26
- };
27
-
28
- // src/presets/mui.ts
29
- var mui = {
30
- roles: [
31
- { name: "info", color: "#0288d1" },
32
- { name: "secondary", color: { from: "accent", hue: 180 } }
33
- ],
34
- tokens: [
35
- // background
36
- { name: "background-default", value: { from: "surface" } },
37
- {
38
- name: "background-paper",
39
- value: { from: "surface", emphasis: -0.025 }
40
- },
41
- // text
42
- { name: "text-primary", value: { from: "surface.foreground" } },
43
- {
44
- name: "text-secondary",
45
- value: { from: "surface.foreground", emphasis: -0.2 }
46
- },
47
- {
48
- name: "text-disabled",
49
- value: { from: "surface.foreground", emphasis: -0.4 }
50
- },
51
- // divider
52
- { name: "divider", value: { from: "surface", emphasis: 0.12 } },
53
- // action tokens
54
- { name: "action-hover", value: { from: "surface", emphasis: 0.04 } },
55
- { name: "action-selected", value: { from: "surface", emphasis: 0.08 } },
56
- { name: "action-disabled", value: { from: "surface", emphasis: 0.15 } },
57
- {
58
- name: "action-disabledBackground",
59
- value: { from: "surface", emphasis: 0.06 }
60
- },
61
- { name: "action-focus", value: { from: "surface", emphasis: 0.06 } }
62
- ],
63
- format: {
64
- as: "object",
65
- colors: "hex",
66
- separator: "-",
67
- roleNames: {
68
- accent: "primary",
69
- negative: "error",
70
- positive: "success",
71
- caution: "warning"
72
- },
73
- variantNames: {
74
- DEFAULT: "main",
75
- weak: "light",
76
- strong: "dark",
77
- foreground: "contrastText"
78
- },
79
- excludeRoles: ["surface"]
80
- }
81
- };
82
-
83
- // src/presets/muted.ts
84
- var muted = {
85
- style: {
86
- light: { maxChroma: 0.08 },
87
- dark: { maxChroma: 0.07 },
88
- surfaceMaxChroma: 5e-3,
89
- foregroundMaxChroma: 5e-3
90
- }
91
- };
92
-
93
- // src/presets/shadcn.ts
94
- var shadcn = {
95
- tokens: [
96
- // shadcn uses bare --foreground (not --background-foreground)
97
- { name: "foreground", value: { from: "surface.foreground" } },
98
- // card / popover — same as background
99
- { name: "card", value: { from: "surface" } },
100
- { name: "card-foreground", value: { from: "surface.foreground" } },
101
- { name: "popover", value: { from: "surface" } },
102
- { name: "popover-foreground", value: { from: "surface.foreground" } },
103
- // secondary — subtle contrast from background
104
- { name: "secondary", value: { from: "surface" } },
105
- { name: "secondary-foreground", value: { from: "surface.foreground" } },
106
- // muted — similar to secondary, but with dimmer foreground
107
- { name: "muted", value: { from: "surface" } },
108
- {
109
- name: "muted-foreground",
110
- value: {
111
- from: "surface.foreground",
112
- emphasis: -0.25
113
- }
114
- },
115
- // accent (shadcn meaning: subtle hover highlight, not the brand color)
116
- { name: "accent", value: { from: "surface" } },
117
- { name: "accent-foreground", value: { from: "surface.foreground" } },
118
- // border / input
119
- {
120
- name: "border",
121
- value: { from: "surface", emphasis: 0.8 }
122
- },
123
- {
124
- name: "input",
125
- value: {
126
- from: "surface",
127
- emphasis: 0.8
128
- }
129
- },
130
- // ring — uses the brand/primary color
131
- { name: "ring", value: { from: "accent" } },
132
- // chart tokens colors use brand/priamry color
133
- { name: "chart-1", value: { from: "accent" } },
134
- { name: "chart-2", value: { from: "chart-1", emphasis: -0.04 } },
135
- { name: "chart-3", value: { from: "chart-2", emphasis: -0.04 } },
136
- { name: "chart-4", value: { from: "chart-3", emphasis: -0.04 } },
137
- { name: "chart-5", value: { from: "chart-4", emphasis: -0.04 } }
138
- ],
139
- format: {
140
- as: "css",
141
- colors: "oklch",
142
- roleNames: {
143
- surface: "background",
144
- accent: "primary",
145
- negative: "destructive",
146
- positive: "success"
147
- },
148
- variantNames: {
149
- foreground: "foreground"
150
- },
151
- excludeRoles: ["caution"],
152
- excludeVariants: ["strong", "weak", "foreground-weak"]
153
- }
154
- };
155
-
156
- // src/presets/tinted.ts
157
- var tinted = {
158
- style: {
159
- surfaceMaxChroma: 0.05,
160
- surfaceHueShift: 0,
161
- foregroundMaxChroma: 0.015
162
- }
163
- };
164
-
165
- // src/presets/vibrant.ts
166
- var vibrant = {
167
- style: {
168
- light: { maxChroma: 0.2, baseLightness: 0.6 },
169
- dark: { maxChroma: 0.18, baseLightness: 0.65 },
170
- hueShift: 5,
171
- surfaceHueShift: 180,
172
- surfaceMaxChroma: 0.08
173
- }
174
- };
175
-
176
- export {
177
- bold,
178
- mui,
179
- muted,
180
- shadcn,
181
- tinted,
182
- vibrant,
183
- presets_exports
184
- };
@@ -1,93 +0,0 @@
1
- import { g as HextimatePreset, d as ColorInput, H as HextimatePaletteBuilder } from './HextimatePaletteBuilder-CPmTYcEY.js';
2
-
3
- /**
4
- * Darker accents on light themes, lighter accents on dark themes.
5
- * Higher chroma for neutrals.
6
- */
7
- declare const bold: HextimatePreset;
8
-
9
- /**
10
- * Accent color plus optional presets - plain, serializable theme input.
11
- *
12
- * Shared vocabulary between app code and tooling: the same object an app runs
13
- * is the object a design-tool plugin runs.
14
- */
15
- type HextimateConfig = {
16
- color: ColorInput;
17
- presets?: HextimatePreset[];
18
- };
19
- /** Apply a {@link HextimateConfig}: `hextimate(color)` then each preset in order. */
20
- declare function fromConfig(c: HextimateConfig): HextimatePaletteBuilder;
21
-
22
- /**
23
- * Preset for Material UI (MUI) projects.
24
- *
25
- * Generates palette tokens matching MUI's theme structure:
26
- * `primary`, `secondary`, `error`, `warning`, `info`, `success` —
27
- * each with `main`, `light`, `dark`, and `contrastText` variants.
28
- *
29
- * Also generates `background` (`default`, `paper`), `text` (`primary`,
30
- * `secondary`, `disabled`), `divider`, and `action` tokens.
31
- *
32
- * Defaults to `object` format for use with `createTheme()`. Override with
33
- * `.format({ as: 'css' })` for MUI's CSS variables mode.
34
- *
35
- * @example
36
- * import { hextimate, presets } from 'hextimator';
37
- * import { createTheme } from '@mui/material/styles';
38
- *
39
- * const palette = hextimate('#6366F1')
40
- * .preset(presets.mui)
41
- * .format();
42
- *
43
- * const theme = createTheme({ palette: palette.light });
44
- */
45
- declare const mui: HextimatePreset;
46
-
47
- /** Desaturated, restrained palette. Low chroma across the board. */
48
- declare const muted: HextimatePreset;
49
-
50
- /**
51
- * Preset for shadcn/ui projects.
52
- *
53
- * Generates all CSS variables that shadcn/ui components expect:
54
- * `--background`, `--foreground`, `--primary`, `--secondary`, `--muted`,
55
- * `--accent`, `--destructive`, `--card`, `--popover`, `--border`, `--input`, `--ring`,
56
- * plus their `-foreground` counterparts.
57
- *
58
- * Defaults to `oklch` color format (modern shadcn). Override with
59
- * `.format({ colors: 'hsl-raw' })` for older shadcn setups.
60
- *
61
- * @example
62
- * import { hextimate, presets } from 'hextimator';
63
- *
64
- * const theme = hextimate('#6366F1')
65
- * .preset(presets.shadcn)
66
- * .format();
67
- *
68
- * // Use with React hook:
69
- * const palette = useHextimator('#6366F1', {
70
- * configure: (b) => b.preset(presets.shadcn),
71
- * });
72
- */
73
- declare const shadcn: HextimatePreset;
74
-
75
- /** Neutrals pick up the accent hue for a cohesive, branded feel. */
76
- declare const tinted: HextimatePreset;
77
-
78
- /** High-saturation palette. Colors that pop. */
79
- declare const vibrant: HextimatePreset;
80
-
81
- type index_HextimateConfig = HextimateConfig;
82
- declare const index_HextimatePreset: typeof HextimatePreset;
83
- declare const index_bold: typeof bold;
84
- declare const index_mui: typeof mui;
85
- declare const index_muted: typeof muted;
86
- declare const index_shadcn: typeof shadcn;
87
- declare const index_tinted: typeof tinted;
88
- declare const index_vibrant: typeof vibrant;
89
- declare namespace index {
90
- export { type index_HextimateConfig as HextimateConfig, index_HextimatePreset as HextimatePreset, index_bold as bold, index_mui as mui, index_muted as muted, index_shadcn as shadcn, index_tinted as tinted, index_vibrant as vibrant };
91
- }
92
-
93
- export { type HextimateConfig as H, muted as a, bold as b, fromConfig as f, index as i, mui as m, shadcn as s, tinted as t, vibrant as v };