hextimator 0.5.1 → 0.7.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 +33 -3
- package/README.md +11 -8
- package/dist/{HextimatePaletteBuilder-BY1EjhFs.d.ts → HextimatePaletteBuilder-Bc-GHsBy.d.ts} +69 -35
- package/dist/{chunk-RAI6L6AN.js → chunk-4WWRI5QJ.js} +107 -64
- package/dist/{chunk-JODPLAXA.js → chunk-NTF3K3U3.js} +36 -36
- package/dist/cli.js +157 -113
- package/dist/{index-C2l4fSiA.d.ts → index-B9eHpF-F.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/presets.d.ts +2 -2
- package/dist/presets.js +1 -1
- package/dist/react.d.ts +4 -4
- package/dist/react.js +2 -2
- package/fallback.css +12 -12
- package/llms.txt +42 -42
- package/package.json +3 -1
- package/tailwind-inverted.css +22 -0
- package/tailwind.css +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as Color, a as CVDType, O as OKLCH, b as ColorSpace, c as ColorInSpace, d as ColorInput, H as HextimatePaletteBuilder } from './HextimatePaletteBuilder-
|
|
2
|
-
export { D as DerivedToken, F as FlatTokenMap, e as FormatResult, f as HextimateFormatOptions, g as HextimateOptions, h as HextimatePreset, i as HextimateResult, j as HextimateStyleOptions, N as NestedTokenMap, T as ThemeAdjustments, k as TokenValue, V as VariantPlacement } from './HextimatePaletteBuilder-
|
|
3
|
-
export { i as presets } from './index-
|
|
1
|
+
import { C as Color, a as CVDType, O as OKLCH, b as ColorSpace, c as ColorInSpace, d as ColorInput, H as HextimatePaletteBuilder } from './HextimatePaletteBuilder-Bc-GHsBy.js';
|
|
2
|
+
export { D as DerivedToken, F as FlatTokenMap, e as FormatResult, f as HextimateFormatOptions, g as HextimateOptions, h as HextimatePreset, i as HextimateResult, j as HextimateStyleOptions, N as NestedTokenMap, T as ThemeAdjustments, k as TokenValue, V as VariantPlacement } from './HextimatePaletteBuilder-Bc-GHsBy.js';
|
|
3
|
+
export { i as presets } from './index-B9eHpF-F.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Daltonize a color for a specific type of color vision deficiency (CVD).
|
|
@@ -80,7 +80,7 @@ declare class HextimateError extends Error {
|
|
|
80
80
|
* @example
|
|
81
81
|
* // Extended: add roles and variants before formatting
|
|
82
82
|
* const theme = hextimate('#ff6600')
|
|
83
|
-
* .style({ light: {
|
|
83
|
+
* .style({ light: { baseLightness: 0.5 }, dark: { baseLightness: 0.65, maxChroma: 0.1 } })
|
|
84
84
|
* .addRole('cta', '#ee2244')
|
|
85
85
|
* .addVariant('hover', { from: 'strong' })
|
|
86
86
|
* .format({ as: 'tailwind' });
|
package/dist/index.js
CHANGED
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
hextimate,
|
|
7
7
|
parse,
|
|
8
8
|
simulateColor
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4WWRI5QJ.js";
|
|
10
10
|
import {
|
|
11
11
|
presets_exports
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-NTF3K3U3.js";
|
|
13
13
|
export {
|
|
14
14
|
HextimateError,
|
|
15
15
|
HextimatePaletteBuilder,
|
package/dist/presets.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { b as bold, m as mui, a as muted, s as shadcn, t as tinted, v as vibrant } from './index-
|
|
2
|
-
export { h as HextimatePreset } from './HextimatePaletteBuilder-
|
|
1
|
+
export { b as bold, m as mui, a as muted, s as shadcn, t as tinted, v as vibrant } from './index-B9eHpF-F.js';
|
|
2
|
+
export { h as HextimatePreset } from './HextimatePaletteBuilder-Bc-GHsBy.js';
|
package/dist/presets.js
CHANGED
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as HextimateStyleOptions, h as HextimatePreset, H as HextimatePaletteBuilder, i as HextimateResult, F as FlatTokenMap, f as HextimateFormatOptions } from './HextimatePaletteBuilder-
|
|
1
|
+
import { j as HextimateStyleOptions, h as HextimatePreset, H as HextimatePaletteBuilder, i as HextimateResult, F as FlatTokenMap, f as HextimateFormatOptions } from './HextimatePaletteBuilder-Bc-GHsBy.js';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
import { PropsWithChildren, RefObject, CSSProperties, ReactNode } from 'react';
|
|
4
4
|
|
|
@@ -49,7 +49,7 @@ interface HextimatorContextValue {
|
|
|
49
49
|
setPresets: (presets: HextimatePreset[] | undefined) => void;
|
|
50
50
|
configure: ((builder: HextimatePaletteBuilder) => void) | undefined;
|
|
51
51
|
setConfigure: (fn: ((builder: HextimatePaletteBuilder) => void) | undefined) => void;
|
|
52
|
-
/** Generated `{ light, dark }` palette as flat token maps (e.g. `{
|
|
52
|
+
/** Generated `{ light, dark }` palette as flat token maps (e.g. `{ surface: '#...', 'surface-strong': '#...' }`). */
|
|
53
53
|
palette: HextimateResult<FlatTokenMap>;
|
|
54
54
|
/** Underlying palette builder. Nested scopes fork from it. */
|
|
55
55
|
builder: HextimatePaletteBuilder;
|
|
@@ -122,7 +122,7 @@ declare function HextimatorScope({ defaultColor, isolated, style: initialStyle,
|
|
|
122
122
|
* cleanup), and supports scoping the palette to a specific selector so
|
|
123
123
|
* multiple subtrees can carry different themes via CSS cascade.
|
|
124
124
|
*
|
|
125
|
-
* - `color`: The
|
|
125
|
+
* - `color`: The accent color to generate the palette from.
|
|
126
126
|
* - `style`: Options for how the palette is generated.
|
|
127
127
|
* - `format`: Options for how the generated palette is formatted.
|
|
128
128
|
* - `configure`: A callback to further customize the palette builder before formatting.
|
|
@@ -193,7 +193,7 @@ interface UseHextimatorOptions {
|
|
|
193
193
|
* });
|
|
194
194
|
* ```
|
|
195
195
|
*
|
|
196
|
-
* @param color - The
|
|
196
|
+
* @param color - The accent color to generate the palette from.
|
|
197
197
|
* @param options - Configuration options for palette generation, formatting, and CSS variable injection.
|
|
198
198
|
*/
|
|
199
199
|
declare function useHextimator(color: string, options?: UseHextimatorOptions): HextimateResult<FlatTokenMap>;
|
package/dist/react.js
CHANGED
package/fallback.css
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--
|
|
3
|
-
--
|
|
4
|
-
--
|
|
5
|
-
--
|
|
2
|
+
--surface: #f5f5f5;
|
|
3
|
+
--surface-strong: #fcfcfc;
|
|
4
|
+
--surface-weak: #ebebeb;
|
|
5
|
+
--surface-foreground: #030303;
|
|
6
6
|
--accent: #aeaeae;
|
|
7
7
|
--accent-strong: #989898;
|
|
8
8
|
--accent-weak: #cecece;
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
}
|
|
25
25
|
@media (prefers-color-scheme: dark) {
|
|
26
26
|
:root:not(.light) {
|
|
27
|
-
--
|
|
28
|
-
--
|
|
29
|
-
--
|
|
30
|
-
--
|
|
27
|
+
--surface: #161616;
|
|
28
|
+
--surface-strong: #030303;
|
|
29
|
+
--surface-weak: #2e2e2e;
|
|
30
|
+
--surface-foreground: #f5f5f5;
|
|
31
31
|
--accent: #a8a8a8;
|
|
32
32
|
--accent-strong: #b7b7b7;
|
|
33
33
|
--accent-weak: #989898;
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
:root.dark {
|
|
52
|
-
--
|
|
53
|
-
--
|
|
54
|
-
--
|
|
55
|
-
--
|
|
52
|
+
--surface: #161616;
|
|
53
|
+
--surface-strong: #030303;
|
|
54
|
+
--surface-weak: #2e2e2e;
|
|
55
|
+
--surface-foreground: #f5f5f5;
|
|
56
56
|
--accent: #a8a8a8;
|
|
57
57
|
--accent-strong: #b7b7b7;
|
|
58
58
|
--accent-weak: #989898;
|
package/llms.txt
CHANGED
|
@@ -42,7 +42,7 @@ Tune how the palette is built with `.style(partial)` (`HextimateStyleOptions`, s
|
|
|
42
42
|
| `.addVariant(name, placement)` | Add a lightness step to every role. `placement`: `{ from: "strong" }`, `{ from: "weak" }`, or `{ between: ["DEFAULT", "weak"] }` |
|
|
43
43
|
| `.addToken(name, value)` | Add a standalone derived token. `value`: a color, `{ from: "role.variant", emphasis?, lightness?, chroma?, hue? }`, or `{ light: ..., dark: ... }` for per-theme values. `emphasis` is theme-aware (positive = more contrast, negative = softer) |
|
|
44
44
|
| `.preset(preset)` | Apply a preset (chainable -- call multiple times to layer style + framework presets). Preset format defaults are overridden by `.format()` options |
|
|
45
|
-
| `.style(partial)` | Merge style options into the builder, regenerate
|
|
45
|
+
| `.style(partial)` | Merge style options into the builder, regenerate palettes, and replay recorded operations |
|
|
46
46
|
| `.simulate(cvdType, severity?)` | Simulate color vision deficiency. Types: `protanopia`, `deuteranopia`, `tritanopia`, `achromatopsia` |
|
|
47
47
|
| `.adaptFor(cvdType, severity?)` | Optimize palette for a CVD type (use instead of simulate for actual accessibility) |
|
|
48
48
|
| `.fork(color?)` | Clone builder with optional new accent color. Chain `.style()` on the fork to change style options. Original unchanged |
|
|
@@ -76,15 +76,15 @@ Pick the dark wrapper with `darkMode`: `"media"` (default) wraps dark tokens in
|
|
|
76
76
|
|
|
77
77
|
| Option | Type | Default | Description |
|
|
78
78
|
|---|---|---|---|
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
79
|
+
| `surfaceColor` | color input | auto-derived | Override surface/neutral baseline color |
|
|
80
|
+
| `surfaceHueShift` | degrees | `0` | Rotate surface hue relative to accent. Ignored if `surfaceColor` set |
|
|
81
|
+
| `invertDarkModeSurfaceAccent` | boolean | `false` | Swap surface/accent hues in dark mode. Useful when the accent should become the background in dark mode. Requires `surfaceColor` |
|
|
82
82
|
| `semanticColors` | `{ positive?, negative?, warning? }` | auto | Override semantic colors (green/red/amber) |
|
|
83
83
|
| `semanticColorRanges` | `{ positive?: [start,end], ... }` | greens, reds, ambers | Hue ranges for semantic detection |
|
|
84
|
-
| `
|
|
84
|
+
| `surfaceMaxChroma` | number | `0.01` | Max chroma for surface colors |
|
|
85
85
|
| `foregroundMaxChroma` | number | `0.01` | Max chroma for foreground colors |
|
|
86
|
-
| `light` | `{
|
|
87
|
-
| `dark` | `{
|
|
86
|
+
| `light` | `{ baseLightness?, maxChroma? }` | `{ baseLightness: 0.7 }` | Light theme adjustments. `baseLightness` is the absolute OKLCH anchor for the accent (distinct from the relative `lightness` offset on derived tokens) |
|
|
87
|
+
| `dark` | `{ baseLightness?, maxChroma? }` | `{ baseLightness: 0.6 }` | Dark theme adjustments |
|
|
88
88
|
| `minContrastRatio` | `"AAA"`, `"AA"`, or number | `"AAA"` | WCAG contrast target (AAA=7, AA=4.5) |
|
|
89
89
|
| `hueShift` | degrees | `0` | Per-variant hue rotation |
|
|
90
90
|
|
|
@@ -92,11 +92,11 @@ Pick the dark wrapper with `darkMode`: `"media"` (default) wraps dark tokens in
|
|
|
92
92
|
|
|
93
93
|
Every palette includes 5 roles x 4 variants + 2 brand tokens = 22 tokens:
|
|
94
94
|
|
|
95
|
-
- Roles: `
|
|
95
|
+
- Roles: `surface`, `accent`, `positive`, `negative`, `warning`
|
|
96
96
|
- Variants: `DEFAULT` (no suffix), `strong`, `weak`, `foreground`
|
|
97
97
|
- Brand tokens: `brand-exact` (the exact input color, unmodified), `brand-exact-foreground` (best-contrast foreground for that color)
|
|
98
98
|
|
|
99
|
-
Token keys: `accent`, `accent-strong`, `accent-weak`, `accent-foreground`, `
|
|
99
|
+
Token keys: `accent`, `accent-strong`, `accent-weak`, `accent-foreground`, `surface`, `surface-strong`, ..., `brand-exact`, `brand-exact-foreground`
|
|
100
100
|
|
|
101
101
|
### Presets
|
|
102
102
|
|
|
@@ -163,15 +163,15 @@ interface HextimatePreset {
|
|
|
163
163
|
- A derived reference: `{ from: "role.variant", emphasis?, lightness?, chroma?, hue? }`
|
|
164
164
|
- Per-theme: `{ light: DerivedToken | ColorInput, dark: DerivedToken | ColorInput }`
|
|
165
165
|
|
|
166
|
-
**`from` syntax**: `"role"` resolves to the DEFAULT variant, `"role.variant"` to a specific one. Valid built-in references: `
|
|
166
|
+
**`from` syntax**: `"role"` resolves to the DEFAULT variant, `"role.variant"` to a specific one. Valid built-in references: `surface`, `surface.strong`, `surface.weak`, `surface.foreground`, `accent`, `accent.strong`, etc. Custom roles/tokens added earlier in the preset can also be referenced.
|
|
167
167
|
|
|
168
168
|
**`emphasis`** is theme-aware contrast adjustment. Positive values push the color *away* from the background (more contrast), negative values pull it *toward* the background (softer). The direction flips automatically between light and dark themes, so `emphasis: 0.12` always means "slightly more visible than the source" regardless of theme. Use this instead of per-theme `lightness` splits when you just want "a bit more/less contrast."
|
|
169
169
|
|
|
170
|
-
**`roleNames` / `variantNames`** in format options remap output keys. This is how you match another framework's naming. For example, `roleNames: {
|
|
170
|
+
**`roleNames` / `variantNames`** in format options remap output keys. This is how you match another framework's naming. For example, `roleNames: { surface: "background", accent: "primary" }` turns `surface-strong` into `background-strong` and `accent` into `primary` in the output. `variantNames: { DEFAULT: "main", foreground: "contrastText" }` turns `accent` (DEFAULT) into `primary-main` and `accent-foreground` into `primary-contrastText`.
|
|
171
171
|
|
|
172
172
|
**Role colors** can be derived from other roles: `{ from: "accent", hue: 180 }` creates a role whose hue is rotated 180 degrees from the accent.
|
|
173
173
|
|
|
174
|
-
**Example - custom preset for a design system with "
|
|
174
|
+
**Example - custom preset for a design system with "bg", "brand", and "danger" tokens:**
|
|
175
175
|
|
|
176
176
|
```typescript
|
|
177
177
|
const myPreset: HextimatePreset = {
|
|
@@ -182,25 +182,25 @@ const myPreset: HextimatePreset = {
|
|
|
182
182
|
{ name: "secondary", color: { from: "accent", hue: 180 } },
|
|
183
183
|
],
|
|
184
184
|
tokens: [
|
|
185
|
-
//
|
|
186
|
-
{ name: "
|
|
187
|
-
{ name: "
|
|
188
|
-
{ name: "
|
|
185
|
+
// Canvas tokens derived from surface
|
|
186
|
+
{ name: "canvas", value: { from: "surface" } },
|
|
187
|
+
{ name: "canvas-raised", value: { from: "surface", emphasis: -0.025 } },
|
|
188
|
+
{ name: "canvas-overlay", value: { from: "surface", emphasis: -0.05 } },
|
|
189
189
|
|
|
190
190
|
// Text with varying prominence
|
|
191
|
-
{ name: "text-primary", value: { from: "
|
|
192
|
-
{ name: "text-secondary", value: { from: "
|
|
193
|
-
{ name: "text-disabled", value: { from: "
|
|
191
|
+
{ name: "text-primary", value: { from: "surface.foreground" } },
|
|
192
|
+
{ name: "text-secondary", value: { from: "surface.foreground", emphasis: -0.2 } },
|
|
193
|
+
{ name: "text-disabled", value: { from: "surface.foreground", emphasis: -0.4 } },
|
|
194
194
|
|
|
195
195
|
// Border that adjusts direction per theme
|
|
196
|
-
{ name: "border", value: { from: "
|
|
196
|
+
{ name: "border", value: { from: "surface", emphasis: 0.12 } },
|
|
197
197
|
|
|
198
198
|
// Per-theme token when emphasis alone isn't enough
|
|
199
199
|
{
|
|
200
200
|
name: "divider",
|
|
201
201
|
value: {
|
|
202
|
-
light: { from: "
|
|
203
|
-
dark: { from: "
|
|
202
|
+
light: { from: "surface.weak", lightness: -0.08 },
|
|
203
|
+
dark: { from: "surface.weak", lightness: +0.08 },
|
|
204
204
|
},
|
|
205
205
|
},
|
|
206
206
|
],
|
|
@@ -208,13 +208,13 @@ const myPreset: HextimatePreset = {
|
|
|
208
208
|
as: "css",
|
|
209
209
|
colors: "hex",
|
|
210
210
|
roleNames: {
|
|
211
|
-
|
|
211
|
+
surface: "bg",
|
|
212
212
|
accent: "brand",
|
|
213
213
|
negative: "danger",
|
|
214
214
|
positive: "success",
|
|
215
215
|
},
|
|
216
216
|
variantNames: {
|
|
217
|
-
DEFAULT: "", // no suffix for the
|
|
217
|
+
DEFAULT: "", // no suffix for the default variant
|
|
218
218
|
strong: "bold",
|
|
219
219
|
weak: "subtle",
|
|
220
220
|
foreground: "on", // e.g. --brand-on
|
|
@@ -240,7 +240,7 @@ const asScss = hextimate("#6366F1").preset(myPreset).format({ as: "scss" });
|
|
|
240
240
|
2. Map each token to a hextimator source: which built-in role/variant is it closest to?
|
|
241
241
|
3. Use `roleNames`/`variantNames` to rename the 20 built-in tokens to match the app's naming
|
|
242
242
|
4. Use `tokens` for any extra tokens not covered by the built-in 5x4 grid, deriving them with `from` + `emphasis`/`lightness`/`chroma`/`hue` offsets
|
|
243
|
-
5. Use `roles` if the app has color categories beyond
|
|
243
|
+
5. Use `roles` if the app has color categories beyond surface/accent/positive/negative/warning
|
|
244
244
|
6. Set `format` defaults to match what the app expects (CSS vars, object, etc.)
|
|
245
245
|
|
|
246
246
|
### Standalone tokens with per-theme values
|
|
@@ -248,8 +248,8 @@ const asScss = hextimate("#6366F1").preset(myPreset).format({ as: "scss" });
|
|
|
248
248
|
```typescript
|
|
249
249
|
hextimate("#6366F1")
|
|
250
250
|
.addToken("border", {
|
|
251
|
-
light: { from: "
|
|
252
|
-
dark: { from: "
|
|
251
|
+
light: { from: "surface.weak", lightness: -0.08 },
|
|
252
|
+
dark: { from: "surface.weak", lightness: +0.08 },
|
|
253
253
|
})
|
|
254
254
|
.addToken("ring", { from: "accent" })
|
|
255
255
|
.format({ as: "css" });
|
|
@@ -302,17 +302,17 @@ Both commands are identical. Use whichever you prefer.
|
|
|
302
302
|
| `--selector` | Root selector for `--format css` | `:root` |
|
|
303
303
|
| `--exclude-role` | Omit a role from output by internal name (repeatable) | — |
|
|
304
304
|
| `--exclude-variant` | Omit a variant from output by internal name (repeatable) | — |
|
|
305
|
-
| `--
|
|
306
|
-
| `--
|
|
305
|
+
| `--surface-color` | Override surface color | — |
|
|
306
|
+
| `--surface-hue-shift` | Degrees | `0` |
|
|
307
307
|
| `--hue-shift` | Per-variant hue shift | `0` |
|
|
308
|
-
| `--
|
|
308
|
+
| `--surface-max-chroma` | Max chroma for surface | `0.01` |
|
|
309
309
|
| `--fg-max-chroma` | Max chroma for foreground | `0.01` |
|
|
310
310
|
| `--light-lightness` | Light theme lightness 0-1 | `0.7` |
|
|
311
311
|
| `--light-max-chroma` | Light theme max chroma | — |
|
|
312
312
|
| `--dark-lightness` | Dark theme lightness 0-1 | `0.6` |
|
|
313
313
|
| `--dark-max-chroma` | Dark theme max chroma | — |
|
|
314
314
|
| `--min-contrast` | `AAA`, `AA`, or number | `AAA` |
|
|
315
|
-
| `--invert-dark` | Swap
|
|
315
|
+
| `--invert-dark` | Swap surface/accent hues in dark mode (requires --surface-color) | — |
|
|
316
316
|
| `--positive` | Override positive/success color | auto |
|
|
317
317
|
| `--negative` | Override negative/error color | auto |
|
|
318
318
|
| `--warning` | Override warning color | auto |
|
|
@@ -333,8 +333,8 @@ npx hextimator "#6366F1" --preset shadcn
|
|
|
333
333
|
# Chained presets: muted style + shadcn framework
|
|
334
334
|
npx hextimator "#6366F1" --preset muted --preset shadcn
|
|
335
335
|
|
|
336
|
-
# Invert
|
|
337
|
-
npx hextimator "#6A5ACD" --
|
|
336
|
+
# Invert surface/accent in dark mode
|
|
337
|
+
npx hextimator "#6A5ACD" --surface-color "#FEBA5D" --invert-dark
|
|
338
338
|
|
|
339
339
|
# Custom roles and variants
|
|
340
340
|
npx hextimator "#22aa44" --role cta=#ee2244 --variant hover:from:strong -o theme.css
|
|
@@ -471,7 +471,7 @@ Props: `defaultColor` (`string \| { light, dark }`), `isolated?`, `style?`, `pre
|
|
|
471
471
|
|
|
472
472
|
## `fallback.css`
|
|
473
473
|
|
|
474
|
-
Pre-JS placeholder: neutral values for the same variables as default `hextimate()` output. Use in client-rendered apps so the first paint has `--accent`, `--
|
|
474
|
+
Pre-JS placeholder: neutral values for the same variables as default `hextimate()` output. Use in client-rendered apps so the first paint has `--accent`, `--surface`, etc. before the bundle runs. Runtime theme CSS then replaces them.
|
|
475
475
|
|
|
476
476
|
```css
|
|
477
477
|
@import "hextimator/fallback.css";
|
|
@@ -487,7 +487,7 @@ Does not cover preset-only token names (e.g. shadcn's `--ring`). Use the CLI to
|
|
|
487
487
|
@import "hextimator/tailwind.css";
|
|
488
488
|
```
|
|
489
489
|
|
|
490
|
-
This registers all built-in tokens as Tailwind utilities (`bg-accent`, `text-
|
|
490
|
+
This registers all built-in tokens as Tailwind utilities (`bg-accent`, `text-surface-foreground`, etc.).
|
|
491
491
|
|
|
492
492
|
## Common recipes
|
|
493
493
|
|
|
@@ -496,11 +496,11 @@ This registers all built-in tokens as Tailwind utilities (`bg-accent`, `text-bas
|
|
|
496
496
|
```typescript
|
|
497
497
|
const theme = hextimate("#52FE8C")
|
|
498
498
|
.style({
|
|
499
|
-
|
|
500
|
-
|
|
499
|
+
surfaceColor: "#FEBA5D",
|
|
500
|
+
invertDarkModeSurfaceAccent: true,
|
|
501
501
|
})
|
|
502
502
|
.format({ as: "css" });
|
|
503
|
-
// Dark mode uses the accent hue as background,
|
|
503
|
+
// Dark mode uses the accent hue as background, surface hue as accent
|
|
504
504
|
```
|
|
505
505
|
|
|
506
506
|
### shadcn/ui theme
|
|
@@ -517,13 +517,13 @@ hextimate("#6366F1")
|
|
|
517
517
|
### Multi-tenant with `.fork()`
|
|
518
518
|
|
|
519
519
|
```typescript
|
|
520
|
-
const
|
|
521
|
-
.style({
|
|
520
|
+
const builder = hextimate("#52FE8C")
|
|
521
|
+
.style({ surfaceColor: "#FEBA5D" })
|
|
522
522
|
.addRole("banner", "#ff006e")
|
|
523
523
|
.addVariant("hover", { from: "strong" });
|
|
524
524
|
|
|
525
|
-
const tenantA =
|
|
526
|
-
const tenantB =
|
|
525
|
+
const tenantA = builder.fork("#ff6677").format({ as: "css" });
|
|
526
|
+
const tenantB = builder.fork("#3a86ff").format({ as: "css" });
|
|
527
527
|
```
|
|
528
528
|
|
|
529
529
|
### Color vision deficiency
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hextimator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Runtime theming for multi-tenant apps: per-tenant branded themes from a single brand color, with WCAG contrast guarantees.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"runtime-theming",
|
|
@@ -63,11 +63,13 @@
|
|
|
63
63
|
},
|
|
64
64
|
"./cli": "./dist/cli.js",
|
|
65
65
|
"./tailwind.css": "./tailwind.css",
|
|
66
|
+
"./tailwind-inverted.css": "./tailwind-inverted.css",
|
|
66
67
|
"./fallback.css": "./fallback.css"
|
|
67
68
|
},
|
|
68
69
|
"files": [
|
|
69
70
|
"dist",
|
|
70
71
|
"tailwind.css",
|
|
72
|
+
"tailwind-inverted.css",
|
|
71
73
|
"fallback.css",
|
|
72
74
|
"llms.txt",
|
|
73
75
|
"CHANGELOG.md"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@theme inline {
|
|
2
|
+
--color-accent-inverted: var(--accent-inverted);
|
|
3
|
+
--color-accent-strong-inverted: var(--accent-strong-inverted);
|
|
4
|
+
--color-accent-weak-inverted: var(--accent-weak-inverted);
|
|
5
|
+
--color-accent-foreground-inverted: var(--accent-foreground-inverted);
|
|
6
|
+
--color-surface-inverted: var(--surface-inverted);
|
|
7
|
+
--color-surface-strong-inverted: var(--surface-strong-inverted);
|
|
8
|
+
--color-surface-weak-inverted: var(--surface-weak-inverted);
|
|
9
|
+
--color-surface-foreground-inverted: var(--surface-foreground-inverted);
|
|
10
|
+
--color-positive-inverted: var(--positive-inverted);
|
|
11
|
+
--color-positive-strong-inverted: var(--positive-strong-inverted);
|
|
12
|
+
--color-positive-weak-inverted: var(--positive-weak-inverted);
|
|
13
|
+
--color-positive-foreground-inverted: var(--positive-foreground-inverted);
|
|
14
|
+
--color-negative-inverted: var(--negative-inverted);
|
|
15
|
+
--color-negative-strong-inverted: var(--negative-strong-inverted);
|
|
16
|
+
--color-negative-weak-inverted: var(--negative-weak-inverted);
|
|
17
|
+
--color-negative-foreground-inverted: var(--negative-foreground-inverted);
|
|
18
|
+
--color-warning-inverted: var(--warning-inverted);
|
|
19
|
+
--color-warning-strong-inverted: var(--warning-strong-inverted);
|
|
20
|
+
--color-warning-weak-inverted: var(--warning-weak-inverted);
|
|
21
|
+
--color-warning-foreground-inverted: var(--warning-foreground-inverted);
|
|
22
|
+
}
|
package/tailwind.css
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
--color-accent-strong: var(--accent-strong);
|
|
4
4
|
--color-accent-weak: var(--accent-weak);
|
|
5
5
|
--color-accent-foreground: var(--accent-foreground);
|
|
6
|
-
--color-
|
|
7
|
-
--color-
|
|
8
|
-
--color-
|
|
9
|
-
--color-
|
|
6
|
+
--color-surface: var(--surface);
|
|
7
|
+
--color-surface-strong: var(--surface-strong);
|
|
8
|
+
--color-surface-weak: var(--surface-weak);
|
|
9
|
+
--color-surface-foreground: var(--surface-foreground);
|
|
10
10
|
--color-positive: var(--positive);
|
|
11
11
|
--color-positive-strong: var(--positive-strong);
|
|
12
12
|
--color-positive-weak: var(--positive-weak);
|