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/CHANGELOG.md +20 -0
- package/README.md +84 -39
- package/dist/{HextimatePaletteBuilder-CPmTYcEY.d.ts → HextimatePaletteBuilder-2hj-zvnW.d.ts} +105 -4
- package/dist/{chunk-FEOOTCAG.js → chunk-3JIC7LRE.js} +249 -46
- package/dist/chunk-Q6KJLMLM.js +251 -0
- package/dist/cli.js +366 -158
- package/dist/index-B1LYbLO5.d.ts +365 -0
- package/dist/index.d.ts +28 -15
- package/dist/index.js +10 -4
- package/dist/presets.d.ts +2 -2
- package/dist/presets.js +1 -1
- package/dist/react.d.ts +26 -11
- package/dist/react.js +24 -9
- package/fallback.css +12 -0
- package/llms.txt +44 -20
- package/package.json +2 -2
- package/tailwind-inverted.css +17 -0
- package/tailwind.css +5 -0
- package/dist/chunk-23UBW2KU.js +0 -184
- package/dist/index-An21acU4.d.ts +0 -93
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## 0.15.0
|
|
2
|
+
|
|
3
|
+
### Minor Changes
|
|
4
|
+
|
|
5
|
+
- [#200](https://github.com/fgrgic/hextimator/pull/200) [`b220fdf`](https://github.com/fgrgic/hextimator/commit/b220fdf0e113e883afa25673e2e7f1634ffd9dcc) Thanks [@fgrgic](https://github.com/fgrgic)! - Deprecate `fromConfig()`, `HextimateConfig`, `.preset()`, `HextimatePreset`, `.style()`, `.addRole()`, `.addVariant()`, `.addToken()`, and `format.roleNames` in favor of `hextimate(accent, theme)`. They still work. The migration guide shows the theme equivalent of each.
|
|
6
|
+
|
|
7
|
+
- [#202](https://github.com/fgrgic/hextimator/pull/202) [`ad90f31`](https://github.com/fgrgic/hextimator/commit/ad90f31000bd9d53a4138f8beb11ecbd06c86aed) Thanks [@fgrgic](https://github.com/fgrgic)! - Add a `theme` option to `useHextimator`, `HextimatorProvider`, `HextimatorScope`, and `HextimatorStyle`. It builds with `hextimate(color, theme)`, and `configure` runs after it. A scope with its own `theme` builds fresh instead of inheriting the parent. Deprecate the `style` and `presets` options in favor of `theme`. They still work.
|
|
8
|
+
|
|
9
|
+
- [#187](https://github.com/fgrgic/hextimator/pull/187) [`616f4bd`](https://github.com/fgrgic/hextimator/commit/616f4bdb2cd51abb915086635059443bb9499113) Thanks [@fgrgic](https://github.com/fgrgic)! - Add `surface-foreground-accent`, `surface-foreground-positive`, `surface-foreground-negative`, and `surface-foreground-caution`. Each is text in the role's color that meets `minContrastRatio` on surface DEFAULT, weak, and strong. Use `text-surface-foreground-negative` for an error message on the page. Existing tokens are unchanged.
|
|
10
|
+
|
|
11
|
+
- [#199](https://github.com/fgrgic/hextimator/pull/199) [`4ecb246`](https://github.com/fgrgic/hextimator/commit/4ecb246f41eff44e6bc9b875361da5976fadb344) Thanks [@fgrgic](https://github.com/fgrgic)! - Add `tailwindAliases(theme)` to generate Tailwind v4 aliases for a custom theme's runtime CSS variables. Pass `{ inverted: true }` to generate aliases for inverted tokens. The package build now generates both shipped Tailwind stylesheets from `baseTheme`.
|
|
12
|
+
|
|
13
|
+
- [#198](https://github.com/fgrgic/hextimator/pull/198) [`9bd8db7`](https://github.com/fgrgic/hextimator/commit/9bd8db73a221dd3b2e5cb467d65ddcec917e1fa1) Thanks [@fgrgic](https://github.com/fgrgic)! - Add `hextimate(accent, theme)` to generate light and dark palettes from a reusable `ThemeDefinition`. Extend `baseTheme` to define your own, or use one of the six built-ins from `themes`.
|
|
14
|
+
|
|
15
|
+
## 0.14.4
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#184](https://github.com/fgrgic/hextimator/pull/184) [`e03d185`](https://github.com/fgrgic/hextimator/commit/e03d185d2ccfe1e9d68bd93fc5f8ba7e0be9ce56) Thanks [@fgrgic](https://github.com/fgrgic)! - Add `theme` property: `theme: 'dark' | 'light' | 'both'`, defaulting to `'both'`
|
|
20
|
+
|
|
1
21
|
## 0.14.3
|
|
2
22
|
|
|
3
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
Runtime theming for multi-tenant apps.
|
|
14
14
|
|
|
15
|
-
Your customers pick a brand color
|
|
15
|
+
Your customers pick a brand color; your app always looks good. No per-customer design reviews. No manual tuning. Yellow does not break your UI.
|
|
16
16
|
|
|
17
17
|
Each call takes under a millisecond (~0.4ms [^perf]). Same color and options always produce the same tokens. Run it on the request path. Cache it if you want.
|
|
18
18
|
|
|
@@ -23,7 +23,7 @@ Try it: **[hextimator.com](https://hextimator.com)**
|
|
|
23
23
|
## Why `hextimator` exists
|
|
24
24
|
|
|
25
25
|
<p align="center">
|
|
26
|
-
<video src="https://github.com/user-attachments/assets/
|
|
26
|
+
<video src="https://github.com/user-attachments/assets/fec967e9-9e5d-4bb1-8e02-15fbc02afb0b" width="100%" controls playsinline></video>
|
|
27
27
|
</p>
|
|
28
28
|
|
|
29
29
|
You ship a B2B, B2B2C, or white-label app. Every tenant brings a brand color. Your choices today:
|
|
@@ -45,72 +45,117 @@ hextimator is not the first palette generator. It targets one job the others ski
|
|
|
45
45
|
|
|
46
46
|
Hand-crafting one brand's design system? Several of these beat hextimator. Color comes from user input (tenants, white-label customers, CMS authors)? That is hextimator's job.
|
|
47
47
|
|
|
48
|
-
##
|
|
48
|
+
## 30-second start
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
51
|
npm i hextimator
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
**Tailwind v4:** import `hextimator/tailwind.css` in your CSS entry (see [Tailwind](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/tailwind.md)).
|
|
55
|
-
|
|
56
|
-
## 30-second integration
|
|
57
|
-
|
|
58
54
|
```ts
|
|
59
55
|
import { hextimate } from "hextimator";
|
|
60
56
|
|
|
61
57
|
const css = hextimate("#C0FFEE").format({ as: "css" });
|
|
62
58
|
```
|
|
63
59
|
|
|
64
|
-
|
|
60
|
+
One color in, light and dark CSS variables out. Ship them however you like: inline `<style>`, a `.css` file, an edge cache. No DOM, so it works with SSR.
|
|
65
61
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
### React (SSR-safe)
|
|
62
|
+
React:
|
|
69
63
|
|
|
70
64
|
```tsx
|
|
71
65
|
import { HextimatorStyle } from "hextimator/react";
|
|
72
66
|
|
|
73
|
-
<HextimatorStyle color=
|
|
67
|
+
<HextimatorStyle color="#0FF1CE" />;
|
|
74
68
|
```
|
|
75
69
|
|
|
76
|
-
|
|
70
|
+
CLI: `npx hextimator '#BADA55'`
|
|
71
|
+
|
|
72
|
+
## Tailwind
|
|
77
73
|
|
|
78
|
-
|
|
74
|
+
```css
|
|
75
|
+
@import "tailwindcss";
|
|
76
|
+
@import "hextimator/tailwind.css";
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<button class="bg-accent text-accent-foreground">Save</button>
|
|
81
|
+
<p class="text-surface-foreground-negative">Payment failed</p>
|
|
82
|
+
```
|
|
79
83
|
|
|
80
|
-
|
|
84
|
+
Every class uses your brand color, run through the theme. Change the color at runtime and the classes follow.
|
|
81
85
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
## Theme
|
|
87
|
+
|
|
88
|
+
The theme decides what your brand color turns into. You can use it as is, add to it, or replace it.
|
|
89
|
+
|
|
90
|
+
### Use it as is
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
hextimate(accent).format();
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
You get five roles: `surface`, `accent`, `positive`, `negative`, and `caution`. Each has `DEFAULT`, `strong`, `weak`, `foreground`, and `foreground-weak`. The surface also gets readable colored text for each role, such as `surface-foreground-negative`. Plus `brand-exact`, your input color unchanged.
|
|
97
|
+
|
|
98
|
+
Every foreground meets WCAG AAA contrast against its background.
|
|
99
|
+
|
|
100
|
+
### Add to it
|
|
101
|
+
|
|
102
|
+
Spread `baseTheme` and add what you need:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { baseTheme, hextimate, type ThemeDefinition } from "hextimator";
|
|
106
|
+
|
|
107
|
+
const theme = {
|
|
108
|
+
...baseTheme,
|
|
109
|
+
roles: { ...baseTheme.roles, cta: { color: "#ee2244" } },
|
|
110
|
+
tokens: [...baseTheme.tokens, { name: "ring", value: { from: "accent" } }],
|
|
111
|
+
} satisfies ThemeDefinition;
|
|
112
|
+
|
|
113
|
+
hextimate(accent, theme).format();
|
|
87
114
|
```
|
|
88
115
|
|
|
89
|
-
|
|
116
|
+
With Tailwind, keep `hextimator/tailwind.css` and register the new names:
|
|
117
|
+
|
|
118
|
+
```css
|
|
119
|
+
@theme inline {
|
|
120
|
+
--color-cta: var(--cta);
|
|
121
|
+
--color-cta-foreground: var(--cta-foreground);
|
|
122
|
+
--color-ring: var(--ring);
|
|
123
|
+
}
|
|
124
|
+
```
|
|
90
125
|
|
|
91
|
-
|
|
92
|
-
| -------- | ------------------------------------------------- |
|
|
93
|
-
| surface | DEFAULT, strong, weak, foreground, foreground-weak |
|
|
94
|
-
| accent | DEFAULT, strong, weak, foreground, foreground-weak |
|
|
95
|
-
| positive | DEFAULT, strong, weak, foreground, foreground-weak |
|
|
96
|
-
| negative | DEFAULT, strong, weak, foreground, foreground-weak |
|
|
97
|
-
| caution | DEFAULT, strong, weak, foreground, foreground-weak |
|
|
126
|
+
### Replace it
|
|
98
127
|
|
|
99
|
-
|
|
128
|
+
Declare only what you want:
|
|
100
129
|
|
|
101
|
-
|
|
130
|
+
```ts
|
|
131
|
+
const theme = {
|
|
132
|
+
roles: {
|
|
133
|
+
page: { generate: "surface" },
|
|
134
|
+
brand: { generate: "accent" },
|
|
135
|
+
danger: { generate: "negative" },
|
|
136
|
+
},
|
|
137
|
+
} satisfies ThemeDefinition;
|
|
138
|
+
|
|
139
|
+
hextimate(accent, theme).format(); // --page, --brand, --danger, ...
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
With Tailwind, generate the stylesheet from your theme in a build script and import it instead of `hextimator/tailwind.css`:
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
import { tailwindAliases } from "hextimator";
|
|
146
|
+
|
|
147
|
+
writeFileSync("src/hextimator-theme.css", tailwindAliases(theme));
|
|
148
|
+
```
|
|
102
149
|
|
|
103
|
-
|
|
150
|
+
Rerun it when the theme changes. Accent changes need no rebuild.
|
|
104
151
|
|
|
105
|
-
-
|
|
106
|
-
- [Extending the palette](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/extending-the-palette.md): `addRole`, `addVariant`, `addToken`
|
|
107
|
-
- [Presets](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/presets.md): shadcn/ui configs and custom presets
|
|
108
|
-
- [Multiple themes](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/multiple-themes.md): dynamic theming and `.fork()`
|
|
109
|
-
- [React](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/react.md): hook, `HextimatorStyle`, provider, scoped themes, dark mode
|
|
110
|
-
- [Tailwind CSS v4](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/tailwind.md): setup and usage
|
|
152
|
+
Ready-made themes for shadcn/ui, MUI, and a few styles live in `themes`: `hextimate(accent, themes.shadcn)`.
|
|
111
153
|
|
|
112
|
-
|
|
154
|
+
## Docs
|
|
113
155
|
|
|
156
|
+
- [Themes](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/themes.md): every field, style, and format option
|
|
157
|
+
- [Built-in themes](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/presets.md)
|
|
158
|
+
- [React](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/react.md)
|
|
114
159
|
- [Color vision deficiency](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/color-vision-deficiency.md)
|
|
115
160
|
- [Examples](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/examples.md)
|
|
116
161
|
- [Migration](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md)
|
|
@@ -123,7 +168,7 @@ APCA is the perceptual model in draft WCAG 3. Better for a lot of UI. Not what p
|
|
|
123
168
|
|
|
124
169
|
## Stability
|
|
125
170
|
|
|
126
|
-
The API follows strict semver.
|
|
171
|
+
The API follows strict semver. Theme fields, builder methods, options, formats, CLI flags, and token names only break in majors, with notes in migration.md.
|
|
127
172
|
|
|
128
173
|
Generated color values are a separate contract. Output is fully deterministic: same version, same color, same options, same tokens. The algorithm itself may improve in minors (wider hue ranges, better anchors), which changes the exact values a theme produces. Every such change is flagged in the changelog with how to opt back into the old behavior.
|
|
129
174
|
|
package/dist/{HextimatePaletteBuilder-CPmTYcEY.d.ts → HextimatePaletteBuilder-2hj-zvnW.d.ts}
RENAMED
|
@@ -100,7 +100,8 @@ interface ThemeAdjustments {
|
|
|
100
100
|
*/
|
|
101
101
|
baseLightnessRange?: readonly [number, number];
|
|
102
102
|
/**
|
|
103
|
-
* Minimum contrast between non-foreground variants and foreground
|
|
103
|
+
* Minimum contrast between non-foreground variants and foreground, and
|
|
104
|
+
* between `surface-foreground-<role>` and every surface variant.
|
|
104
105
|
* `"AAA"` → 7, `"AA"` → 4.5, or a number.
|
|
105
106
|
*/
|
|
106
107
|
minContrastRatio?: 'AAA' | 'AA' | number;
|
|
@@ -178,6 +179,9 @@ interface HextimateFormatOptions {
|
|
|
178
179
|
* - positive: "positive"
|
|
179
180
|
* - negative: "negative"
|
|
180
181
|
* - caution: "caution"
|
|
182
|
+
*
|
|
183
|
+
* @deprecated Rename roles with `ThemeDefinition` role keys: `roles: { brand: { generate: 'accent' } }`.
|
|
184
|
+
* See the {@link https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md#014x--0150-themes | Migration guide}.
|
|
181
185
|
*/
|
|
182
186
|
roleNames?: Record<string, string>;
|
|
183
187
|
/**
|
|
@@ -223,6 +227,15 @@ interface HextimateFormatOptions {
|
|
|
223
227
|
* change the root selector.
|
|
224
228
|
*/
|
|
225
229
|
as?: 'object' | 'css' | 'tailwind' | 'tailwind-css' | 'scss' | 'json';
|
|
230
|
+
/**
|
|
231
|
+
* Theme palettes to include in stylesheet outputs (`as: 'css'`, `as: 'tailwind-css'`).
|
|
232
|
+
* Ignored for every other output format.
|
|
233
|
+
*
|
|
234
|
+
* - `'both'` (default): emit light tokens plus dark tokens using `darkMode`
|
|
235
|
+
* - `'light'`: emit light tokens only
|
|
236
|
+
* - `'dark'`: emit dark tokens as the root theme, without a dark-mode wrapper
|
|
237
|
+
*/
|
|
238
|
+
theme?: 'light' | 'dark' | 'both';
|
|
226
239
|
/**
|
|
227
240
|
* Dark-mode strategy for stylesheet outputs (`as: 'css'`, `as: 'tailwind-css'`).
|
|
228
241
|
* Ignored for every other output format.
|
|
@@ -230,7 +243,7 @@ interface HextimateFormatOptions {
|
|
|
230
243
|
* - `'media'` (default): wraps dark tokens in `@media (prefers-color-scheme: dark)`
|
|
231
244
|
* - `'class'`: dark tokens apply under `.dark` (and descendants)
|
|
232
245
|
* - `'data-attribute'`: dark tokens apply under `[data-theme="dark"]`
|
|
233
|
-
* - `false`: omit dark tokens entirely (light
|
|
246
|
+
* - `false`: omit dark tokens entirely (legacy alias for `theme: 'light'`)
|
|
234
247
|
*/
|
|
235
248
|
darkMode?: 'media' | 'class' | 'data-attribute' | false;
|
|
236
249
|
/**
|
|
@@ -313,6 +326,9 @@ type FormatResult = FlatTokenMap | NestedTokenMap | string;
|
|
|
313
326
|
* const theme = hextimate('#6366F1')
|
|
314
327
|
* .preset(presets.shadcn)
|
|
315
328
|
* .format();
|
|
329
|
+
*
|
|
330
|
+
* @deprecated Use a `ThemeDefinition` with `hextimate(accent, theme)`.
|
|
331
|
+
* See the {@link https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md#014x--0150-themes | Migration guide}.
|
|
316
332
|
*/
|
|
317
333
|
interface HextimatePreset {
|
|
318
334
|
/** Style options (contrast, hue shifts, lightness, chroma). Applied before roles/variants/tokens. */
|
|
@@ -336,6 +352,70 @@ interface HextimatePreset {
|
|
|
336
352
|
format?: HextimateFormatOptions;
|
|
337
353
|
}
|
|
338
354
|
|
|
355
|
+
type RoleGenerator = 'surface' | 'accent' | 'positive' | 'negative' | 'caution';
|
|
356
|
+
type TokenGenerator = 'brand-exact' | 'brand-exact-foreground';
|
|
357
|
+
type RoleDefinition = {
|
|
358
|
+
generate: RoleGenerator;
|
|
359
|
+
} | {
|
|
360
|
+
color: ColorInput;
|
|
361
|
+
} | DerivedToken;
|
|
362
|
+
type ThemeTokenValue = TokenValue | {
|
|
363
|
+
generate: TokenGenerator;
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* A palette structure that turns any accent into light and dark palettes.
|
|
367
|
+
* Plain data, so it survives a JSON round trip.
|
|
368
|
+
*/
|
|
369
|
+
interface ThemeDefinition {
|
|
370
|
+
/** Accent for tools that preview a theme on its own. `hextimate(accent, theme)` ignores it. */
|
|
371
|
+
defaultAccent?: ColorInput;
|
|
372
|
+
style?: HextimateStyleOptions;
|
|
373
|
+
/** The key sets the output role name. */
|
|
374
|
+
roles?: Record<string, RoleDefinition>;
|
|
375
|
+
variants?: Array<{
|
|
376
|
+
name: string;
|
|
377
|
+
placement: VariantPlacement;
|
|
378
|
+
}>;
|
|
379
|
+
tokens?: Array<{
|
|
380
|
+
name: string;
|
|
381
|
+
value: ThemeTokenValue;
|
|
382
|
+
}>;
|
|
383
|
+
/** Renames variant suffixes in the output, such as `{ foreground: 'contrastText' }`. */
|
|
384
|
+
variantNames?: Record<string, string>;
|
|
385
|
+
/** Default output options. `.format()` options override them. */
|
|
386
|
+
format?: HextimateFormatOptions;
|
|
387
|
+
}
|
|
388
|
+
declare const baseTheme: {
|
|
389
|
+
roles: {
|
|
390
|
+
surface: {
|
|
391
|
+
generate: "surface";
|
|
392
|
+
};
|
|
393
|
+
accent: {
|
|
394
|
+
generate: "accent";
|
|
395
|
+
};
|
|
396
|
+
positive: {
|
|
397
|
+
generate: "positive";
|
|
398
|
+
};
|
|
399
|
+
negative: {
|
|
400
|
+
generate: "negative";
|
|
401
|
+
};
|
|
402
|
+
caution: {
|
|
403
|
+
generate: "caution";
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
tokens: ({
|
|
407
|
+
name: string;
|
|
408
|
+
value: {
|
|
409
|
+
generate: "brand-exact";
|
|
410
|
+
};
|
|
411
|
+
} | {
|
|
412
|
+
name: string;
|
|
413
|
+
value: {
|
|
414
|
+
generate: "brand-exact-foreground";
|
|
415
|
+
};
|
|
416
|
+
})[];
|
|
417
|
+
};
|
|
418
|
+
|
|
339
419
|
/** The result of formatting a palette, containing both light and dark theme tokens. */
|
|
340
420
|
interface HextimateResult<F = FormatResult> {
|
|
341
421
|
light: F;
|
|
@@ -394,21 +474,31 @@ declare class HextimatePaletteBuilder {
|
|
|
394
474
|
private lightPalette;
|
|
395
475
|
private darkPalette;
|
|
396
476
|
private readonly inputColor;
|
|
477
|
+
private readonly theme;
|
|
397
478
|
private options;
|
|
398
479
|
private readonly operations;
|
|
399
480
|
private readonly standaloneTokens;
|
|
481
|
+
private readonly foregroundOverrides;
|
|
400
482
|
private readonly weakSideVariants;
|
|
401
483
|
private readonly strongSideVariants;
|
|
402
484
|
private readonly foregroundAnchoredVariants;
|
|
403
485
|
private readonly betweenVariants;
|
|
404
486
|
private presetFormatDefaults?;
|
|
405
|
-
constructor(color: Color);
|
|
487
|
+
constructor(color: Color, theme?: ThemeDefinition);
|
|
406
488
|
/**
|
|
407
489
|
* Merges style options into the builder and regenerates the palettes,
|
|
408
490
|
* then replays recorded operations so roles and variants reflect the new style.
|
|
491
|
+
*
|
|
492
|
+
* @deprecated Set `style` on a `ThemeDefinition`: `hextimate(accent, { ...theme, style })`.
|
|
493
|
+
* See the {@link https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md#014x--0150-themes | Migration guide}.
|
|
409
494
|
*/
|
|
410
495
|
style(partial: Partial<HextimateStyleOptions>): this;
|
|
411
496
|
private seedOptionsForFork;
|
|
497
|
+
/** Custom roles, variants, tokens, and format defaults from the theme. Generated roles already exist. */
|
|
498
|
+
private applyTheme;
|
|
499
|
+
private resolveThemeToken;
|
|
500
|
+
/** Every role the theme declares gets colored text on its surface role. */
|
|
501
|
+
private surfaceForegroundRoles;
|
|
412
502
|
private rebuildFromOperations;
|
|
413
503
|
private replayOperationInPlace;
|
|
414
504
|
/**
|
|
@@ -422,6 +512,8 @@ declare class HextimatePaletteBuilder {
|
|
|
422
512
|
*
|
|
423
513
|
* @param name Role name (e.g. "cta", "banner")
|
|
424
514
|
* @param color Base color or derived token for the role
|
|
515
|
+
* @deprecated Declare the role in a `ThemeDefinition`: `roles: { cta: { color: '#ff0066' } }`.
|
|
516
|
+
* See the {@link https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md#014x--0150-themes | Migration guide}.
|
|
425
517
|
*/
|
|
426
518
|
addRole(name: string, color: ColorInput | DerivedToken): this;
|
|
427
519
|
/**
|
|
@@ -432,6 +524,8 @@ declare class HextimatePaletteBuilder {
|
|
|
432
524
|
*
|
|
433
525
|
* @param name Variant name (e.g. "placeholder", "highlight")
|
|
434
526
|
* @param placement Placement of the variant, either `{ from: 'weak' }` or `{ between: ['DEFAULT', 'strong'] }`
|
|
527
|
+
* @deprecated Declare the variant in a `ThemeDefinition`: `variants: [{ name, placement }]`.
|
|
528
|
+
* See the {@link https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md#014x--0150-themes | Migration guide}.
|
|
435
529
|
*/
|
|
436
530
|
addVariant(name: string, placement: VariantPlacement): this;
|
|
437
531
|
/**
|
|
@@ -439,6 +533,9 @@ declare class HextimatePaletteBuilder {
|
|
|
439
533
|
*
|
|
440
534
|
* Override with a dotted key: `surface.weak`, `surface.DEFAULT` (not `surface-weak`).
|
|
441
535
|
* A kebab key that matches a generated label throws at format time.
|
|
536
|
+
*
|
|
537
|
+
* @deprecated Declare the token in a `ThemeDefinition`: `tokens: [{ name, value }]`.
|
|
538
|
+
* See the {@link https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md#014x--0150-themes | Migration guide}.
|
|
442
539
|
*/
|
|
443
540
|
addToken(name: string, value: TokenValue): this;
|
|
444
541
|
/**
|
|
@@ -459,6 +556,9 @@ declare class HextimatePaletteBuilder {
|
|
|
459
556
|
* const theme = hextimate('#6366F1')
|
|
460
557
|
* .preset(presets.shadcn)
|
|
461
558
|
* .format({ colors: 'hsl-raw' });
|
|
559
|
+
*
|
|
560
|
+
* @deprecated Pass a `ThemeDefinition`: `hextimate(accent, themes.shadcn)`.
|
|
561
|
+
* See the {@link https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md#014x--0150-themes | Migration guide}.
|
|
462
562
|
*/
|
|
463
563
|
preset(preset: HextimatePreset): this;
|
|
464
564
|
/**
|
|
@@ -529,6 +629,7 @@ declare class HextimatePaletteBuilder {
|
|
|
529
629
|
}): HextimateResult<FlatTokenMap>;
|
|
530
630
|
format(options?: HextimateFormatOptions): HextimateResult | string;
|
|
531
631
|
private buildInvertedEntries;
|
|
632
|
+
private outputPalette;
|
|
532
633
|
private applyRole;
|
|
533
634
|
private applyVariant;
|
|
534
635
|
private applyAnchoredVariant;
|
|
@@ -560,4 +661,4 @@ declare class HextimatePaletteBuilder {
|
|
|
560
661
|
private resolvedOptions;
|
|
561
662
|
}
|
|
562
663
|
|
|
563
|
-
export { type Color as C, type DerivedToken as D, type FlatTokenMap as F, HextimatePaletteBuilder as H, type NestedTokenMap as N, type OKLCH as O, type
|
|
664
|
+
export { type Color as C, type DerivedToken as D, type FlatTokenMap as F, HextimatePaletteBuilder as H, type NestedTokenMap as N, type OKLCH as O, type RoleDefinition as R, type ThemeDefinition as T, type VariantPlacement as V, type CVDType as a, type ColorSpace as b, type ColorInSpace as c, type ColorInput as d, type HextimateFormatOptions as e, type FormatResult as f, type HextimatePreset as g, type HextimateResult as h, type HextimateStyleOptions as i, type RoleGenerator as j, type ThemeAdjustments as k, type ThemeTokenValue as l, type TokenGenerator as m, type TokenValue as n, baseTheme as o };
|