hextimator 0.4.0 → 0.5.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/dist/index.js CHANGED
@@ -5,9 +5,11 @@ import {
5
5
  daltonizeColor,
6
6
  hextimate,
7
7
  parse,
8
- presets_exports,
9
8
  simulateColor
10
- } from "./chunk-2OMHLWID.js";
9
+ } from "./chunk-RAI6L6AN.js";
10
+ import {
11
+ presets_exports
12
+ } from "./chunk-JODPLAXA.js";
11
13
  export {
12
14
  HextimateError,
13
15
  HextimatePaletteBuilder,
@@ -0,0 +1,2 @@
1
+ export { b as bold, m as mui, a as muted, s as shadcn, t as tinted, v as vibrant } from './index-C2l4fSiA.js';
2
+ export { h as HextimatePreset } from './HextimatePaletteBuilder-BY1EjhFs.js';
@@ -0,0 +1,16 @@
1
+ import {
2
+ bold,
3
+ mui,
4
+ muted,
5
+ shadcn,
6
+ tinted,
7
+ vibrant
8
+ } from "./chunk-JODPLAXA.js";
9
+ export {
10
+ bold,
11
+ mui,
12
+ muted,
13
+ shadcn,
14
+ tinted,
15
+ vibrant
16
+ };
package/dist/react.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { j as HextimateStyleOptions, H as HextimatePreset, e as HextimatePaletteBuilder, i as HextimateResult, g as HextimateFormatOptions, F as FlatTokenMap } from './HextimatePaletteBuilder-xqJwP_G2.js';
1
+ import { j as HextimateStyleOptions, h as HextimatePreset, H as HextimatePaletteBuilder, i as HextimateResult, F as FlatTokenMap, f as HextimateFormatOptions } from './HextimatePaletteBuilder-BY1EjhFs.js';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import { PropsWithChildren, RefObject, CSSProperties, ReactNode } from 'react';
4
4
 
@@ -49,8 +49,8 @@ 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. */
53
- palette: HextimateResult;
52
+ /** Generated `{ light, dark }` palette as flat token maps (e.g. `{ base: '#...', 'base-strong': '#...' }`). */
53
+ palette: HextimateResult<FlatTokenMap>;
54
54
  /** Underlying palette builder. Nested scopes fork from it. */
55
55
  builder: HextimatePaletteBuilder;
56
56
  }
package/dist/react.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  hextimate
3
- } from "./chunk-2OMHLWID.js";
3
+ } from "./chunk-RAI6L6AN.js";
4
+ import "./chunk-JODPLAXA.js";
4
5
 
5
6
  // src/react/hextimator-provider.tsx
6
7
  import {
@@ -20,7 +21,7 @@ var HextimatorContext = createContext(
20
21
  function buildStyleContent(palette, darkMode, cssPrefix, selector = ":root") {
21
22
  const lightEntries = Object.entries(palette.light);
22
23
  const darkEntries = Object.entries(palette.dark);
23
- const toVars = (entries, lineIndent) => entries.map(([key, value]) => `${lineIndent}${cssPrefix}${key}: ${value};`).join("\n");
24
+ const toVars = (entries, lineIndent) => entries.map(([key, value]) => `${lineIndent}${cssPrefix}--${key}: ${value};`).join("\n");
24
25
  const lightVars = toVars(lightEntries, " ");
25
26
  const darkVars = toVars(darkEntries, " ");
26
27
  const darkVarsInMediaInner = toVars(darkEntries, " ");
@@ -86,12 +87,10 @@ ${darkVars}
86
87
  }
87
88
  function buildTargetedVars(palette, darkMode, cssPrefix) {
88
89
  const prefixEntries = (entries) => entries.map(
89
- ([key, value]) => [`${cssPrefix}${key}`, value]
90
+ ([key, value]) => [`${cssPrefix}--${key}`, value]
90
91
  );
91
92
  return {
92
- light: prefixEntries(
93
- Object.entries(palette.light)
94
- ),
93
+ light: prefixEntries(Object.entries(palette.light)),
95
94
  dark: darkMode !== false ? prefixEntries(Object.entries(palette.dark)) : []
96
95
  };
97
96
  }
@@ -263,12 +262,12 @@ function HextimatorProvider({
263
262
  const palette = useMemo(() => {
264
263
  const lightResult = lightBuilder.format({
265
264
  ...stable?.format,
266
- as: "css"
265
+ as: "object"
267
266
  });
268
267
  if (darkBuilder === lightBuilder) return lightResult;
269
268
  const darkResult = darkBuilder.format({
270
269
  ...stable?.format,
271
- as: "css"
270
+ as: "object"
272
271
  });
273
272
  return { light: lightResult.light, dark: darkResult.dark };
274
273
  }, [lightBuilder, darkBuilder, stable?.format]);
@@ -426,12 +425,12 @@ function HextimatorScope({
426
425
  const palette = useMemo2(() => {
427
426
  const lightResult = lightBuilder.format({
428
427
  ...stable?.format,
429
- as: "css"
428
+ as: "object"
430
429
  });
431
430
  if (darkBuilder === lightBuilder) return lightResult;
432
431
  const darkResult = darkBuilder.format({
433
432
  ...stable?.format,
434
- as: "css"
433
+ as: "object"
435
434
  });
436
435
  return { light: lightResult.light, dark: darkResult.dark };
437
436
  }, [lightBuilder, darkBuilder, stable?.format]);
@@ -531,7 +530,7 @@ function HextimatorStyle({
531
530
  configure?.(builder);
532
531
  const palette = builder.format({
533
532
  ...stable?.format,
534
- as: "css"
533
+ as: "object"
535
534
  });
536
535
  return buildStyleContent(
537
536
  palette,
@@ -559,7 +558,7 @@ function useHextimator(color, options) {
559
558
  configure?.(builder);
560
559
  return builder.format({
561
560
  ...stable?.format,
562
- as: "css"
561
+ as: "object"
563
562
  });
564
563
  }, [color, stable?.style, presets, stable?.format, configure]);
565
564
  const darkMode = stable?.darkMode ?? { type: "media" };
package/llms.txt CHANGED
@@ -17,9 +17,9 @@ import { hextimate } from "hextimator";
17
17
  const theme = hextimate("#6A5ACD").format();
18
18
  // → { light: { accent: "#6a5acd", "accent-strong": "...", ... }, dark: { ... } }
19
19
 
20
- // With format options
20
+ // With format options — `as: "css"` returns a ready-to-paste stylesheet string
21
21
  const css = hextimate("#6A5ACD").format({ as: "css", colors: "oklch" });
22
- // → { light: { "--accent": "oklch(...)", ... }, dark: { ... } }
22
+ // → ":root { --accent: oklch(...); ... }\n@media (prefers-color-scheme: dark) { :root { ... } }"
23
23
  ```
24
24
 
25
25
  ## API
@@ -48,7 +48,7 @@ Tune how the palette is built with `.style(partial)` (`HextimateStyleOptions`, s
48
48
  | `.fork(color?)` | Clone builder with optional new accent color. Chain `.style()` on the fork to change style options. Original unchanged |
49
49
  | `.format(options?)` | Output the palette (see format options) |
50
50
 
51
- ### `.format(options?)` → `{ light: FormatResult, dark: FormatResult }`
51
+ ### `.format(options?)` → `{ light: FormatResult, dark: FormatResult }` or `string`
52
52
 
53
53
  | Option | Values | Default |
54
54
  |---|---|---|
@@ -57,16 +57,20 @@ Tune how the palette is built with `.style(partial)` (`HextimateStyleOptions`, s
57
57
  | `roleNames` | `Record<string, string>` — rename roles in output keys | built-in names |
58
58
  | `variantNames` | `Record<string, string>` — rename variant suffixes | built-in names |
59
59
  | `separator` | `string` — between role and variant in keys | `"-"` |
60
+ | `darkMode` | `"media"`, `"class"`, `"data-attribute"`, `false` (stylesheet outputs only) | `"media"` |
61
+ | `selector` | `string` — root selector for `as: "css"` | `":root"` |
60
62
  | `excludeRoles` | `string[]` — role keys to omit entirely from output (by internal name, before `roleNames`) | `[]` |
61
63
  | `excludeVariants` | `string[]` — variant keys to omit from every role's output (by internal name, before `variantNames`) | `[]` |
62
64
 
63
65
  Output shape depends on `as`:
64
- - `"object"` → `Record<string, string>` flat map: `{ accent: "#...", "accent-strong": "#..." }`
65
- - `"css"` → `Record<string, string>` flat map: `{ "--accent": "#...", "--accent-strong": "#..." }`
66
- - `"tailwind"` → nested map: `{ accent: { DEFAULT: "#...", strong: "#..." } }`
67
- - `"tailwind-css"` → string: `@theme { --color-accent: #...; }`
68
- - `"scss"` → `Record<string, string>` flat map: `{ "$accent": "#...", "$accent-strong": "#..." }`
69
- - `"json"` → JSON string
66
+ - `"object"` → `{ light, dark }` flat maps: `{ accent: "#...", "accent-strong": "#..." }`
67
+ - `"css"` → `string` — ready-to-paste CSS stylesheet with `:root {}` and a dark-mode wrapper
68
+ - `"tailwind"` → `{ light, dark }` nested maps: `{ accent: { DEFAULT: "#...", strong: "#..." } }`
69
+ - `"tailwind-css"` → `string` — Tailwind v4 stylesheet: single `@theme { --color-accent: #...; }` block plus dark overrides
70
+ - `"scss"` → `{ light, dark }` flat maps: `{ "$accent": "#...", "$accent-strong": "#..." }`
71
+ - `"json"` → `{ light, dark }` JSON strings
72
+
73
+ Pick the dark wrapper with `darkMode`: `"media"` (default) wraps dark tokens in `@media (prefers-color-scheme: dark)`; `"class"` uses `.dark`; `"data-attribute"` uses `[data-theme="dark"]`; `false` omits dark entirely. For `as: "css"`, change the root selector with `selector` (e.g. `selector: "[data-theme]"`).
70
74
 
71
75
  ### Style options (`HextimateStyleOptions`)
72
76
 
@@ -291,9 +295,11 @@ Both commands are identical. Use whichever you prefer.
291
295
  |---|---|---|
292
296
  | `-f, --format` | `css`, `object`, `tailwind`, `tailwind-css`, `scss`, `json` | `css` |
293
297
  | `-c, --colors` | `hex`, `rgb`, `rgb-raw`, `hsl`, `hsl-raw`, `oklch`, `oklch-raw`, `p3`, `p3-raw` | `hex` |
294
- | `-t, --theme` | `light`, `dark`, `both` | `both` |
298
+ | `-t, --theme` | `light`, `dark`, `both` (ignored for `css`/`tailwind-css` — both always combine into one string) | `both` |
295
299
  | `-p, --preset` | Apply preset (repeatable, applied in order): `shadcn`, `mui`, `muted`, `vibrant`, `tinted` | — |
296
300
  | `--separator` | Token separator between role and variant | `-` |
301
+ | `--dark-mode` | `media`, `class`, `data-attribute`, `false` (stylesheet outputs only) | `media` |
302
+ | `--selector` | Root selector for `--format css` | `:root` |
297
303
  | `--exclude-role` | Omit a role from output by internal name (repeatable) | — |
298
304
  | `--exclude-variant` | Omit a variant from output by internal name (repeatable) | — |
299
305
  | `--base-color` | Override base color | — |
package/package.json CHANGED
@@ -1,26 +1,32 @@
1
1
  {
2
2
  "name": "hextimator",
3
- "version": "0.4.0",
4
- "description": "Generate perceptually uniform color palettes with light/dark themes and WCAG contrast guarantees from a single brand color. Outputs CSS vars, Tailwind, SCSS, or JSON.",
3
+ "version": "0.5.1",
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
+ "runtime-theming",
7
+ "multi-tenant",
8
+ "per-tenant",
9
+ "wcag",
10
+ "b2b2c",
11
+ "b2b",
12
+ "saas-theming",
13
+ "white-label",
14
+ "no-code",
15
+ "cms",
16
+ "design-system",
17
+ "multi-brand",
6
18
  "color",
7
19
  "palette",
8
20
  "generator",
9
21
  "creator",
10
22
  "oklch",
11
- "rgb",
12
- "rgb2oklch",
13
23
  "theme",
14
24
  "design-tokens",
15
25
  "dark-mode",
16
- "wcag",
17
26
  "accessibility",
18
27
  "contrast",
19
28
  "brand-color",
20
- "css-variables",
21
- "tailwind-theme",
22
- "runtime-theming",
23
- "multi-tenant"
29
+ "tailwind-theme"
24
30
  ],
25
31
  "homepage": "https://hextimator.com",
26
32
  "bugs": {
@@ -51,6 +57,10 @@
51
57
  "types": "./dist/react.d.ts",
52
58
  "import": "./dist/react.js"
53
59
  },
60
+ "./presets": {
61
+ "types": "./dist/presets.d.ts",
62
+ "import": "./dist/presets.js"
63
+ },
54
64
  "./cli": "./dist/cli.js",
55
65
  "./tailwind.css": "./tailwind.css",
56
66
  "./fallback.css": "./fallback.css"