hextimator 0.9.0 → 0.10.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 +22 -0
- package/README.md +3 -3
- package/dist/{HextimatePaletteBuilder-doYcUGMD.d.ts → HextimatePaletteBuilder-CPteKnVL.d.ts} +42 -105
- package/dist/{chunk-PJSNOIIB.js → chunk-64DBUA5U.js} +346 -91
- package/dist/{chunk-NTF3K3U3.js → chunk-TEZ2I4CJ.js} +3 -2
- package/dist/cli.js +384 -100
- package/dist/{index-rFqBuFuF.d.ts → index-doqaWzrz.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/presets.d.ts +2 -2
- package/dist/presets.js +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +2 -2
- package/fallback.css +48 -48
- package/llms.txt +12 -9
- package/package.json +1 -1
- package/tailwind-inverted.css +4 -4
- package/tailwind.css +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
|
+
## 0.10.1
|
|
2
|
+
|
|
3
|
+
### Patch Changes
|
|
4
|
+
|
|
5
|
+
- [#135](https://github.com/fgrgic/hextimator/pull/135) [`90b3920`](https://github.com/fgrgic/hextimator/commit/90b3920ba60580dfd038bd0e46d0796feffdf718) Thanks [@fgrgic](https://github.com/fgrgic)! - fix wrong priority of parameters for style. `baseLightness` should always take priority if set when calculating the lightness.
|
|
6
|
+
|
|
7
|
+
## 0.10.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- [#127](https://github.com/fgrgic/hextimator/pull/127) [`d0bbf5a`](https://github.com/fgrgic/hextimator/commit/d0bbf5a41ba303c18228057baf9b4ba6dfb016cd) Thanks [@fgrgic](https://github.com/fgrgic)! - - **Breaking.**: Lightness of the theme is derived from the input color's lightness by default. To pin down exact lightness, provide `light.baseLightness`, and/or `dark.baseLIghtness`
|
|
12
|
+
|
|
13
|
+
- Exposes `baseLightnessRange` at the top level and under `light` / `dark` to bound OKLCH **L** for accent and semantic anchors. Defaults: light `[0.4, 0.9]`, dark `[0.2, 0.8]`. CLI: `--base-lightness-range`, `--light-base-lightness-range`, `--dark-base-lightness-range`.
|
|
14
|
+
|
|
15
|
+
- `HextimateStyleOptions` now **extends** `ThemeAdjustments` so shared knobs are declared once; `light` / `dark` use the same shape.
|
|
16
|
+
|
|
17
|
+
- [#126](https://github.com/fgrgic/hextimator/pull/126) [`57ed74a`](https://github.com/fgrgic/hextimator/commit/57ed74af8c1c8d0640d97b4a4318cd02a6fe93f7) Thanks [@fgrgic](https://github.com/fgrgic)! - **Breaking.** Renames built-in semantic role **`warning`** → **`caution`**.
|
|
18
|
+
|
|
19
|
+
Migration checklist: [migration.md](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md) (section _0.9.x → 0.10.0_).
|
|
20
|
+
|
|
1
21
|
## 0.9.0 (Latest)
|
|
2
22
|
|
|
3
23
|
- Widens default semantic hue ranges (`positive` [120,160], `negative` [5,30], `warning` [45,70] OKLCH arcs). Themes using library defaults may get different semantic scales.
|
|
4
24
|
|
|
25
|
+
Migration note: [migration.md](https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md) (section _0.8.x → 0.9.0_).
|
|
26
|
+
|
|
5
27
|
## 0.8.0
|
|
6
28
|
|
|
7
29
|
- Adds optional `keyPrefix` on `HextimateFormatOptions` for flat `as: "object"` and `as: "json"` output (CLI: `--key-prefix`). Use `keyPrefix: "--"` when you want CSS custom property names as object keys without using stylesheet output.
|
package/README.md
CHANGED
|
@@ -154,16 +154,16 @@ Preset **`style`** plus **`.style()`** on the builder is covered in [Extending p
|
|
|
154
154
|
Use `excludeRoles` and `excludeVariants` in `.format()` (or in a preset's `format` field) to drop tokens you don't need:
|
|
155
155
|
|
|
156
156
|
```typescript
|
|
157
|
-
// Drop the
|
|
157
|
+
// Drop the caution role and the strong/weak variants entirely
|
|
158
158
|
hextimate("#F11732").format({
|
|
159
|
-
excludeRoles: ["
|
|
159
|
+
excludeRoles: ["caution"],
|
|
160
160
|
excludeVariants: ["strong", "weak"],
|
|
161
161
|
});
|
|
162
162
|
|
|
163
163
|
// Useful in custom presets to keep output tight
|
|
164
164
|
const myPreset: HextimatePreset = {
|
|
165
165
|
format: {
|
|
166
|
-
excludeRoles: ["
|
|
166
|
+
excludeRoles: ["caution"],
|
|
167
167
|
excludeVariants: ["weak"],
|
|
168
168
|
},
|
|
169
169
|
};
|
package/dist/{HextimatePaletteBuilder-doYcUGMD.d.ts → HextimatePaletteBuilder-CPteKnVL.d.ts}
RENAMED
|
@@ -71,16 +71,17 @@ type ColorTuple = readonly [number, number, number, number?];
|
|
|
71
71
|
*/
|
|
72
72
|
type ColorInput = HexString | CSSColorString | ColorTuple | Color | number;
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* Modifiers to the generation process. Used by {@link HextimateStyleOptions} for
|
|
75
|
+
* global or per-theme (dark/light) settings
|
|
75
76
|
*/
|
|
76
77
|
interface ThemeAdjustments {
|
|
77
78
|
/**
|
|
78
|
-
* Absolute OKLCH lightness anchor for
|
|
79
|
+
* Absolute OKLCH lightness anchor for accent fills (0–1). Distinct from
|
|
80
|
+
* the relative `lightness` offsets used by `addToken({ from, lightness })`.
|
|
79
81
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* Default: 0.7 for light, 0.6 for dark.
|
|
82
|
+
* If omitted, seed from the brand color's OKLCH **L**, clamped via
|
|
83
|
+
* `baseLightnessRange` (per theme object, then top-level, then built-ins:
|
|
84
|
+
* light `[0.4, 0.9]`, dark `[0.2, 0.8]`).
|
|
84
85
|
*/
|
|
85
86
|
baseLightness?: number;
|
|
86
87
|
/**
|
|
@@ -90,129 +91,70 @@ interface ThemeAdjustments {
|
|
|
90
91
|
*/
|
|
91
92
|
lightness?: number;
|
|
92
93
|
/**
|
|
93
|
-
*
|
|
94
|
-
* Colors with higher chroma will be clamped to this value.
|
|
94
|
+
* Max chroma for accent and semantic fills in scope. Higher chroma is clamped.
|
|
95
95
|
*/
|
|
96
96
|
maxChroma?: number;
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
*
|
|
98
|
+
* OKLCH **L** bounds `[min, max]` (0–1) for `baseLightness` and input-derived anchors.
|
|
99
|
+
* Top-level: use one tuple for both themes unless `light` / `dark` set their own.
|
|
100
|
+
*/
|
|
101
|
+
baseLightnessRange?: readonly [number, number];
|
|
102
|
+
/**
|
|
103
|
+
* Minimum contrast between non-foreground variants and foreground.
|
|
104
|
+
* `"AAA"` → 7, `"AA"` → 4.5, or a number.
|
|
104
105
|
*/
|
|
105
106
|
minContrastRatio?: 'AAA' | 'AA' | number;
|
|
106
107
|
/**
|
|
107
|
-
*
|
|
108
|
-
* Overrides the global `surfaceMaxChroma` for this theme only.
|
|
108
|
+
* Max chroma for surface (`surface`, `strong`, `weak`). Default `0.01`.
|
|
109
109
|
*/
|
|
110
110
|
surfaceMaxChroma?: number;
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
113
|
-
* Overrides the global `foregroundMaxChroma` for this theme only.
|
|
112
|
+
* Max chroma for foreground variants (e.g. `accent-foreground`). Default `0.01`.
|
|
114
113
|
*/
|
|
115
114
|
foregroundMaxChroma?: number;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Options that control how the palette is generated from the input color.
|
|
119
|
-
*/
|
|
120
|
-
interface HextimateStyleOptions {
|
|
121
115
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* If not provided, it will be derived from the main input color with very low chroma.
|
|
125
|
-
*
|
|
126
|
-
* Takes precedence over `surfaceHueShift` when both are set.
|
|
116
|
+
* Surface baseline. Top-level: both themes unless `light.surfaceColor` / `dark.surfaceColor`.
|
|
117
|
+
* Omitted: derived from the brand color with low chroma.
|
|
127
118
|
*/
|
|
128
119
|
surfaceColor?: ColorInput;
|
|
129
120
|
/**
|
|
130
|
-
* Rotate
|
|
131
|
-
*
|
|
132
|
-
* Examples: 180 for complementary, 30 for analogous, -30 for the other direction.
|
|
133
|
-
*
|
|
134
|
-
* Ignored when an explicit `surfaceColor` is provided.
|
|
135
|
-
*
|
|
136
|
-
* Default: 0 (same hue as the accent).
|
|
121
|
+
* Rotate surface hue vs accent (degrees). Ignored when `surfaceColor` is set for that scope.
|
|
137
122
|
*/
|
|
138
123
|
surfaceHueShift?: number;
|
|
139
124
|
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* and the semantic color ranges.
|
|
125
|
+
* Per-variant hue shift on accent and semantic scales. Strong-side shifts toward higher hue,
|
|
126
|
+
* weak-side toward lower; each step stacks. Clamped to `360 / (totalVariants + 1)`.
|
|
143
127
|
*/
|
|
128
|
+
hueShift?: number;
|
|
129
|
+
/** Semantic role overrides; nested maps merge per slot with the top-level map. */
|
|
144
130
|
semanticColors?: {
|
|
145
131
|
positive?: ColorInput;
|
|
146
132
|
negative?: ColorInput;
|
|
147
|
-
|
|
133
|
+
caution?: ColorInput;
|
|
148
134
|
};
|
|
149
135
|
/**
|
|
150
|
-
*
|
|
151
|
-
* Uses surface hue as accent, and accent hue as surface.
|
|
152
|
-
* Only has effect if `surfaceColor` is provided alongside the main accent color
|
|
153
|
-
*
|
|
154
|
-
* Default: false.
|
|
155
|
-
*/
|
|
156
|
-
invertDarkModeSurfaceAccent?: boolean;
|
|
157
|
-
/**
|
|
158
|
-
* Degree ranges for the semantic colors.
|
|
159
|
-
* Determines where to look for "green", "red", "yellow" in the color space.
|
|
160
|
-
* If not provided, the default ranges will be used:
|
|
161
|
-
* - positive: [120, 160] greens
|
|
162
|
-
* - negative: [5, 30] reds
|
|
163
|
-
* - warning: [45, 70] ambers
|
|
136
|
+
* OKLCH hue arcs for semantic discovery. Defaults: positive [120,160], negative [5,30], caution [45,70].
|
|
164
137
|
*/
|
|
165
138
|
semanticColorRanges?: {
|
|
166
139
|
positive?: [number, number];
|
|
167
140
|
negative?: [number, number];
|
|
168
|
-
|
|
141
|
+
caution?: [number, number];
|
|
169
142
|
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Options that control how the palette is generated from the input color.
|
|
146
|
+
*
|
|
147
|
+
* Inherits {@link ThemeAdjustments} as global defaults; set `light` / `dark`
|
|
148
|
+
* to override per theme.
|
|
149
|
+
*/
|
|
150
|
+
interface HextimateStyleOptions extends ThemeAdjustments {
|
|
170
151
|
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* Default: 0.01.
|
|
175
|
-
*/
|
|
176
|
-
surfaceMaxChroma?: number;
|
|
177
|
-
/**
|
|
178
|
-
* Maximum chroma for all the foreground colors (e.g. surface-accent-foreground)
|
|
179
|
-
* Higher values will produce more colorful foreground colors, lower values will produce more gray foreground colors.
|
|
180
|
-
*
|
|
181
|
-
* Default: 0.01.
|
|
182
|
-
*/
|
|
183
|
-
foregroundMaxChroma?: number;
|
|
184
|
-
/**
|
|
185
|
-
* Per-theme adjustments for the light theme.
|
|
152
|
+
* In dark mode: surface hue becomes accent and accent hue becomes surface.
|
|
153
|
+
* Requires a `surfaceColor` on the invert path (top-level or `dark`).
|
|
186
154
|
*/
|
|
155
|
+
invertDarkModeSurfaceAccent?: boolean;
|
|
187
156
|
light?: ThemeAdjustments;
|
|
188
|
-
/**
|
|
189
|
-
* Per-theme adjustments for the dark theme.
|
|
190
|
-
*/
|
|
191
157
|
dark?: ThemeAdjustments;
|
|
192
|
-
/**
|
|
193
|
-
* Minimum WCAG contrast ratio between non-foreground variants and the
|
|
194
|
-
* foreground variant.
|
|
195
|
-
*
|
|
196
|
-
* - `"AAA"` (default) → 7
|
|
197
|
-
* - `"AA"` → 4.5
|
|
198
|
-
* - any number → exact ratio (e.g. 3 for large text)
|
|
199
|
-
*/
|
|
200
|
-
minContrastRatio?: 'AAA' | 'AA' | number;
|
|
201
|
-
/**
|
|
202
|
-
* Shift the hue (in degrees) from variant to variant.
|
|
203
|
-
*
|
|
204
|
-
* - Positive value: strong-side variants shift toward higher hues,
|
|
205
|
-
* weak-side variants shift toward lower hues.
|
|
206
|
-
* - Negative value: flips the direction.
|
|
207
|
-
* - Each successive variant on a side shifts by an additional step
|
|
208
|
-
* (e.g. hueShift: 5 → strong +5°, stronger +10°, weak −5°, weaker −10°).
|
|
209
|
-
*
|
|
210
|
-
* Clamped to `360 / (totalVariants + 1)` so the palette never wraps
|
|
211
|
-
* past a full rotation.
|
|
212
|
-
*
|
|
213
|
-
* Default: 0 (no hue shift).
|
|
214
|
-
*/
|
|
215
|
-
hueShift?: number;
|
|
216
158
|
}
|
|
217
159
|
/**
|
|
218
160
|
* Options that affect output formatting (serialization)
|
|
@@ -227,7 +169,7 @@ interface HextimateFormatOptions {
|
|
|
227
169
|
* - accent: "button"
|
|
228
170
|
* - positive: "success"
|
|
229
171
|
* - negative: "error"
|
|
230
|
-
* -
|
|
172
|
+
* - caution: "caution"
|
|
231
173
|
*
|
|
232
174
|
* If not provided, the default role names will be used.
|
|
233
175
|
* The default role names are:
|
|
@@ -235,7 +177,7 @@ interface HextimateFormatOptions {
|
|
|
235
177
|
* - accent: "accent"
|
|
236
178
|
* - positive: "positive"
|
|
237
179
|
* - negative: "negative"
|
|
238
|
-
* -
|
|
180
|
+
* - caution: "caution"
|
|
239
181
|
*/
|
|
240
182
|
roleNames?: Record<string, string>;
|
|
241
183
|
/**
|
|
@@ -315,7 +257,7 @@ interface HextimateFormatOptions {
|
|
|
315
257
|
* Role keys to omit from the output entirely.
|
|
316
258
|
* Uses the internal role name (before any `roleNames` remapping).
|
|
317
259
|
*
|
|
318
|
-
* Example: `['
|
|
260
|
+
* Example: `['caution']` removes the caution scale from the output.
|
|
319
261
|
*/
|
|
320
262
|
excludeRoles?: string[];
|
|
321
263
|
/**
|
|
@@ -350,11 +292,6 @@ interface HextimateFormatOptions {
|
|
|
350
292
|
*/
|
|
351
293
|
invertedVariants?: boolean;
|
|
352
294
|
}
|
|
353
|
-
/**
|
|
354
|
-
* Combined options for the convenience API.
|
|
355
|
-
* Allows passing both style and format options in one call.
|
|
356
|
-
*/
|
|
357
|
-
type HextimateOptions = HextimateStyleOptions & HextimateFormatOptions;
|
|
358
295
|
/** How color values are serialized in the output (e.g. "hex", "rgb", "oklch", "hsl", "p3", and their "-raw" variants). */
|
|
359
296
|
type ColorFormat = 'hex' | 'hsl' | 'hsl-raw' | 'oklch' | 'oklch-raw' | 'p3' | 'p3-raw' | 'rgb' | 'rgb-raw';
|
|
360
297
|
|
|
@@ -620,4 +557,4 @@ declare class HextimatePaletteBuilder {
|
|
|
620
557
|
private resolvedOptions;
|
|
621
558
|
}
|
|
622
559
|
|
|
623
|
-
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 ThemeAdjustments as T, type VariantPlacement as V, type CVDType as a, type ColorSpace as b, type ColorInSpace as c, type ColorInput as d, type FormatResult as e, type HextimateFormatOptions as f, type
|
|
560
|
+
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 ThemeAdjustments as T, type VariantPlacement as V, type CVDType as a, type ColorSpace as b, type ColorInSpace as c, type ColorInput as d, type FormatResult as e, type HextimateFormatOptions as f, type HextimatePreset as g, type HextimateResult as h, type HextimateStyleOptions as i, type TokenValue as j };
|