hextimator 0.14.3 → 0.14.4
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 +6 -0
- package/dist/{HextimatePaletteBuilder-CPmTYcEY.d.ts → HextimatePaletteBuilder-Cb3ElknQ.d.ts} +10 -1
- package/dist/{chunk-FEOOTCAG.js → chunk-HYJCQDLO.js} +12 -4
- package/dist/cli.js +14 -5
- package/dist/{index-An21acU4.d.ts → index-J9z52Ypz.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/presets.d.ts +2 -2
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/llms.txt +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 0.14.4
|
|
2
|
+
|
|
3
|
+
### Patch Changes
|
|
4
|
+
|
|
5
|
+
- [#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'`
|
|
6
|
+
|
|
1
7
|
## 0.14.3
|
|
2
8
|
|
|
3
9
|
### Patch Changes
|
package/dist/{HextimatePaletteBuilder-CPmTYcEY.d.ts → HextimatePaletteBuilder-Cb3ElknQ.d.ts}
RENAMED
|
@@ -223,6 +223,15 @@ interface HextimateFormatOptions {
|
|
|
223
223
|
* change the root selector.
|
|
224
224
|
*/
|
|
225
225
|
as?: 'object' | 'css' | 'tailwind' | 'tailwind-css' | 'scss' | 'json';
|
|
226
|
+
/**
|
|
227
|
+
* Theme palettes to include in stylesheet outputs (`as: 'css'`, `as: 'tailwind-css'`).
|
|
228
|
+
* Ignored for every other output format.
|
|
229
|
+
*
|
|
230
|
+
* - `'both'` (default): emit light tokens plus dark tokens using `darkMode`
|
|
231
|
+
* - `'light'`: emit light tokens only
|
|
232
|
+
* - `'dark'`: emit dark tokens as the root theme, without a dark-mode wrapper
|
|
233
|
+
*/
|
|
234
|
+
theme?: 'light' | 'dark' | 'both';
|
|
226
235
|
/**
|
|
227
236
|
* Dark-mode strategy for stylesheet outputs (`as: 'css'`, `as: 'tailwind-css'`).
|
|
228
237
|
* Ignored for every other output format.
|
|
@@ -230,7 +239,7 @@ interface HextimateFormatOptions {
|
|
|
230
239
|
* - `'media'` (default): wraps dark tokens in `@media (prefers-color-scheme: dark)`
|
|
231
240
|
* - `'class'`: dark tokens apply under `.dark` (and descendants)
|
|
232
241
|
* - `'data-attribute'`: dark tokens apply under `[data-theme="dark"]`
|
|
233
|
-
* - `false`: omit dark tokens entirely (light
|
|
242
|
+
* - `false`: omit dark tokens entirely (legacy alias for `theme: 'light'`)
|
|
234
243
|
*/
|
|
235
244
|
darkMode?: 'media' | 'class' | 'data-attribute' | false;
|
|
236
245
|
/**
|
|
@@ -892,10 +892,15 @@ function darkSelectorFor(mode) {
|
|
|
892
892
|
function formatCSSStylesheet(lightEntries, darkEntries, sep, opts = {}) {
|
|
893
893
|
const selector = opts.selector ?? ":root";
|
|
894
894
|
const darkMode = opts.darkMode ?? "media";
|
|
895
|
+
const theme = opts.theme === "dark" ? "dark" : darkMode === false ? "light" : opts.theme ?? "both";
|
|
895
896
|
const lightBlock = `${selector} {
|
|
896
897
|
${declsFromEntries(lightEntries, sep, "--", " ")}
|
|
897
898
|
}`;
|
|
898
|
-
|
|
899
|
+
const rootDarkBlock = `${selector} {
|
|
900
|
+
${declsFromEntries(darkEntries, sep, "--", " ")}
|
|
901
|
+
}`;
|
|
902
|
+
if (theme === "light") return lightBlock;
|
|
903
|
+
if (theme === "dark") return rootDarkBlock;
|
|
899
904
|
if (darkMode === "media") {
|
|
900
905
|
const darkInner = declsFromEntries(darkEntries, sep, "--", " ");
|
|
901
906
|
return `${lightBlock}
|
|
@@ -914,10 +919,12 @@ ${darkBlock}`;
|
|
|
914
919
|
}
|
|
915
920
|
function formatTailwindStylesheet(lightEntries, darkEntries, sep, opts = {}) {
|
|
916
921
|
const darkMode = opts.darkMode ?? "media";
|
|
922
|
+
const selectedTheme = opts.theme === "dark" ? "dark" : darkMode === false ? "light" : opts.theme ?? "both";
|
|
923
|
+
const themeEntries = selectedTheme === "dark" ? darkEntries : lightEntries;
|
|
917
924
|
const theme = `@theme {
|
|
918
|
-
${declsFromEntries(
|
|
925
|
+
${declsFromEntries(themeEntries, sep, "--color-", " ")}
|
|
919
926
|
}`;
|
|
920
|
-
if (
|
|
927
|
+
if (selectedTheme !== "both") return theme;
|
|
921
928
|
if (darkMode === "media") {
|
|
922
929
|
const darkInner = declsFromEntries(darkEntries, sep, "--color-", " ");
|
|
923
930
|
return `${theme}
|
|
@@ -960,7 +967,8 @@ function formatStylesheet(lightPalette, darkPalette, options, lightStandalone, d
|
|
|
960
967
|
const sep = options?.separator ?? "-";
|
|
961
968
|
const stylesheetOpts = {
|
|
962
969
|
selector: options?.selector,
|
|
963
|
-
darkMode: options?.darkMode
|
|
970
|
+
darkMode: options?.darkMode,
|
|
971
|
+
theme: options?.theme
|
|
964
972
|
};
|
|
965
973
|
if (options?.as === "tailwind-css") {
|
|
966
974
|
return formatTailwindStylesheet(
|
package/dist/cli.js
CHANGED
|
@@ -900,10 +900,15 @@ function darkSelectorFor(mode) {
|
|
|
900
900
|
function formatCSSStylesheet(lightEntries, darkEntries, sep, opts = {}) {
|
|
901
901
|
const selector = opts.selector ?? ":root";
|
|
902
902
|
const darkMode = opts.darkMode ?? "media";
|
|
903
|
+
const theme = opts.theme === "dark" ? "dark" : darkMode === false ? "light" : opts.theme ?? "both";
|
|
903
904
|
const lightBlock = `${selector} {
|
|
904
905
|
${declsFromEntries(lightEntries, sep, "--", " ")}
|
|
905
906
|
}`;
|
|
906
|
-
|
|
907
|
+
const rootDarkBlock = `${selector} {
|
|
908
|
+
${declsFromEntries(darkEntries, sep, "--", " ")}
|
|
909
|
+
}`;
|
|
910
|
+
if (theme === "light") return lightBlock;
|
|
911
|
+
if (theme === "dark") return rootDarkBlock;
|
|
907
912
|
if (darkMode === "media") {
|
|
908
913
|
const darkInner = declsFromEntries(darkEntries, sep, "--", " ");
|
|
909
914
|
return `${lightBlock}
|
|
@@ -922,10 +927,12 @@ ${darkBlock}`;
|
|
|
922
927
|
}
|
|
923
928
|
function formatTailwindStylesheet(lightEntries, darkEntries, sep, opts = {}) {
|
|
924
929
|
const darkMode = opts.darkMode ?? "media";
|
|
930
|
+
const selectedTheme = opts.theme === "dark" ? "dark" : darkMode === false ? "light" : opts.theme ?? "both";
|
|
931
|
+
const themeEntries = selectedTheme === "dark" ? darkEntries : lightEntries;
|
|
925
932
|
const theme = `@theme {
|
|
926
|
-
${declsFromEntries(
|
|
933
|
+
${declsFromEntries(themeEntries, sep, "--color-", " ")}
|
|
927
934
|
}`;
|
|
928
|
-
if (
|
|
935
|
+
if (selectedTheme !== "both") return theme;
|
|
929
936
|
if (darkMode === "media") {
|
|
930
937
|
const darkInner = declsFromEntries(darkEntries, sep, "--color-", " ");
|
|
931
938
|
return `${theme}
|
|
@@ -968,7 +975,8 @@ function formatStylesheet(lightPalette, darkPalette, options, lightStandalone, d
|
|
|
968
975
|
const sep = options?.separator ?? "-";
|
|
969
976
|
const stylesheetOpts = {
|
|
970
977
|
selector: options?.selector,
|
|
971
|
-
darkMode: options?.darkMode
|
|
978
|
+
darkMode: options?.darkMode,
|
|
979
|
+
theme: options?.theme
|
|
972
980
|
};
|
|
973
981
|
if (options?.as === "tailwind-css") {
|
|
974
982
|
return formatTailwindStylesheet(
|
|
@@ -2746,7 +2754,7 @@ Presets:
|
|
|
2746
2754
|
Format options:
|
|
2747
2755
|
-f, --format <type> css | object | tailwind | tailwind-css | scss | json (default: css)
|
|
2748
2756
|
-c, --colors <type> hex | rgb | hsl | oklch | p3 and -raw variants (default: hex)
|
|
2749
|
-
-t, --theme <type> light | dark | both
|
|
2757
|
+
-t, --theme <type> light | dark | both (default: both)
|
|
2750
2758
|
--dark-mode <strategy> media | class | data-attribute | off (css/tailwind-css only, default: media)
|
|
2751
2759
|
--selector <css> Root selector for css output (default: :root)
|
|
2752
2760
|
--separator <char> Token separator (default: -)
|
|
@@ -2994,6 +3002,7 @@ function runCli() {
|
|
|
2994
3002
|
}
|
|
2995
3003
|
const hasPreset = values.preset && values.preset.length > 0;
|
|
2996
3004
|
const formatOptions = {};
|
|
3005
|
+
formatOptions.theme = values.theme;
|
|
2997
3006
|
if (values.format) {
|
|
2998
3007
|
formatOptions.as = values.format;
|
|
2999
3008
|
} else if (!hasPreset) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as HextimatePreset, d as ColorInput, H as HextimatePaletteBuilder } from './HextimatePaletteBuilder-
|
|
1
|
+
import { g as HextimatePreset, d as ColorInput, H as HextimatePaletteBuilder } from './HextimatePaletteBuilder-Cb3ElknQ.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Darker accents on light themes, lighter accents on dark themes.
|
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 HextimatePreset, h as HextimateResult, i as HextimateStyleOptions, N as NestedTokenMap, T as ThemeAdjustments, j as TokenValue, V as VariantPlacement } from './HextimatePaletteBuilder-
|
|
3
|
-
export { H as HextimateConfig, f as fromConfig, 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-Cb3ElknQ.js';
|
|
2
|
+
export { D as DerivedToken, F as FlatTokenMap, e as FormatResult, f as HextimateFormatOptions, g as HextimatePreset, h as HextimateResult, i as HextimateStyleOptions, N as NestedTokenMap, T as ThemeAdjustments, j as TokenValue, V as VariantPlacement } from './HextimatePaletteBuilder-Cb3ElknQ.js';
|
|
3
|
+
export { H as HextimateConfig, f as fromConfig, i as presets } from './index-J9z52Ypz.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Daltonize a color for a specific type of color vision deficiency (CVD).
|
package/dist/index.js
CHANGED
package/dist/presets.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { H as HextimateConfig, b as bold, m as mui, a as muted, s as shadcn, t as tinted, v as vibrant } from './index-
|
|
2
|
-
export { g as HextimatePreset } from './HextimatePaletteBuilder-
|
|
1
|
+
export { H as HextimateConfig, b as bold, m as mui, a as muted, s as shadcn, t as tinted, v as vibrant } from './index-J9z52Ypz.js';
|
|
2
|
+
export { g as HextimatePreset } from './HextimatePaletteBuilder-Cb3ElknQ.js';
|
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as HextimateStyleOptions, g as HextimatePreset, H as HextimatePaletteBuilder, h as HextimateResult, F as FlatTokenMap, f as HextimateFormatOptions } from './HextimatePaletteBuilder-
|
|
1
|
+
import { i as HextimateStyleOptions, g as HextimatePreset, H as HextimatePaletteBuilder, h as HextimateResult, F as FlatTokenMap, f as HextimateFormatOptions } from './HextimatePaletteBuilder-Cb3ElknQ.js';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
import { PropsWithChildren, RefObject, CSSProperties, ReactNode } from 'react';
|
|
4
4
|
|
package/dist/react.js
CHANGED
package/llms.txt
CHANGED
|
@@ -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`
|
|
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` |
|
|
@@ -100,7 +100,7 @@ const sheet = hextimate("#6366f1").format({ as: "css", colors: "oklch" });
|
|
|
100
100
|
| `tailwind-css` | Tailwind v4 `@theme` string |
|
|
101
101
|
| `scss` / `json` | As named |
|
|
102
102
|
|
|
103
|
-
`colors`, `darkMode` (`"media"` \| `"class"` \| `"data-attribute"` \| `false`), `selector`, `roleNames`, `variantNames`, `separator`, `keyPrefix`, `excludeRoles`, `excludeVariants` match the CLI conceptually.
|
|
103
|
+
`colors`, `theme` (`"light"` \| `"dark"` \| `"both"`), `darkMode` (`"media"` \| `"class"` \| `"data-attribute"` \| `false`), `selector`, `roleNames`, `variantNames`, `separator`, `keyPrefix`, `excludeRoles`, `excludeVariants` match the CLI conceptually.
|
|
104
104
|
|
|
105
105
|
### Default token grid
|
|
106
106
|
|