hextimator 0.5.0 → 0.6.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 +14 -4
- package/README.md +82 -18
- package/dist/{HextimatePaletteBuilder-C8I05ZmB.d.ts → HextimatePaletteBuilder-BH1jrzj7.d.ts} +35 -35
- package/dist/chunk-KFR2LTS2.js +183 -0
- package/dist/{chunk-HCVIQY7G.js → chunk-QQZBI4SO.js} +63 -233
- package/dist/cli.js +109 -103
- package/dist/index-Cd9eX-1l.d.ts +79 -0
- package/dist/index.d.ts +4 -79
- package/dist/index.js +4 -2
- package/dist/presets.d.ts +2 -0
- package/dist/presets.js +16 -0
- package/dist/react.d.ts +4 -4
- package/dist/react.js +2 -1
- package/fallback.css +12 -12
- package/llms.txt +40 -40
- package/package.json +19 -9
- package/tailwind.css +4 -4
package/dist/cli.js
CHANGED
|
@@ -1240,20 +1240,20 @@ function calculateContrast(colorA, colorB) {
|
|
|
1240
1240
|
|
|
1241
1241
|
// src/generate/generateAccent.ts
|
|
1242
1242
|
function generateAccent(accent, themeType, options) {
|
|
1243
|
-
const
|
|
1244
|
-
if (
|
|
1243
|
+
const invertSurfaceAndAccent = themeType === "dark" && options?.invertDarkModeSurfaceAccent;
|
|
1244
|
+
if (invertSurfaceAndAccent) {
|
|
1245
1245
|
const accentOklch = convert(accent, "oklch");
|
|
1246
|
-
const
|
|
1247
|
-
let
|
|
1248
|
-
if (
|
|
1249
|
-
|
|
1250
|
-
...
|
|
1251
|
-
h: wrapHue(accentOklch.h +
|
|
1246
|
+
const surfaceHueShift = options?.surfaceHueShift ?? 0;
|
|
1247
|
+
let surfaceOklch = options?.surfaceColor ? convert(parse(options.surfaceColor), "oklch") : convert(accent, "oklch");
|
|
1248
|
+
if (surfaceHueShift !== 0 && !options?.surfaceColor) {
|
|
1249
|
+
surfaceOklch = {
|
|
1250
|
+
...surfaceOklch,
|
|
1251
|
+
h: wrapHue(accentOklch.h + surfaceHueShift)
|
|
1252
1252
|
};
|
|
1253
1253
|
}
|
|
1254
1254
|
const maxChroma = options?.dark?.maxChroma;
|
|
1255
1255
|
const invertedAccent = {
|
|
1256
|
-
...
|
|
1256
|
+
...surfaceOklch,
|
|
1257
1257
|
c: maxChroma !== void 0 ? Math.min(accentOklch.c, maxChroma) : accentOklch.c
|
|
1258
1258
|
};
|
|
1259
1259
|
return expandColorToScale(invertedAccent, themeType, options);
|
|
@@ -1261,47 +1261,6 @@ function generateAccent(accent, themeType, options) {
|
|
|
1261
1261
|
return expandColorToScale(accent, themeType, options);
|
|
1262
1262
|
}
|
|
1263
1263
|
|
|
1264
|
-
// src/generate/generateBase.ts
|
|
1265
|
-
var BASELINE_DARK_L_VALUE = 0.2;
|
|
1266
|
-
var BASELINE_LIGHT_L_VALUE = 0.97;
|
|
1267
|
-
var BASELINE_MAX_CHROMA = 0.01;
|
|
1268
|
-
var STRONG_DELTA_DARK = -0.1;
|
|
1269
|
-
var STRONG_DELTA_LIGHT = 0.02;
|
|
1270
|
-
var WEAK_DELTA_DARK = 0.1;
|
|
1271
|
-
var WEAK_DELTA_LIGHT = -0.03;
|
|
1272
|
-
function generateBase(color, themeType, options) {
|
|
1273
|
-
const invertBaseAndAccent = themeType === "dark" && options?.invertDarkModeBaseAccent;
|
|
1274
|
-
const preferredBaseColorInput = invertBaseAndAccent ? color ?? options?.baseColor : options?.baseColor ?? color;
|
|
1275
|
-
const themeAdjustments = themeType === "light" ? options?.light : options?.dark;
|
|
1276
|
-
const baselineMaxChroma = themeAdjustments?.baseMaxChroma ?? options?.baseMaxChroma ?? BASELINE_MAX_CHROMA;
|
|
1277
|
-
const preferredBaseColor = convert(parse(preferredBaseColorInput), "oklch");
|
|
1278
|
-
let baseHue = preferredBaseColor.h;
|
|
1279
|
-
const baseChroma = Math.min(preferredBaseColor.c, baselineMaxChroma);
|
|
1280
|
-
const baseHueShift = options?.baseHueShift ?? 0;
|
|
1281
|
-
if (baseHueShift !== 0 && !options?.baseColor && !invertBaseAndAccent) {
|
|
1282
|
-
baseHue = wrapHue(convert(color, "oklch").h + baseHueShift);
|
|
1283
|
-
}
|
|
1284
|
-
const normalizedPreferredBaseColor = {
|
|
1285
|
-
...preferredBaseColor,
|
|
1286
|
-
h: baseHue,
|
|
1287
|
-
c: baseChroma,
|
|
1288
|
-
l: themeType === "light" ? BASELINE_LIGHT_L_VALUE : BASELINE_DARK_L_VALUE
|
|
1289
|
-
};
|
|
1290
|
-
return expandColorToScale(normalizedPreferredBaseColor, themeType, {
|
|
1291
|
-
baselineLValueDark: BASELINE_DARK_L_VALUE,
|
|
1292
|
-
baselineLValueLight: BASELINE_LIGHT_L_VALUE,
|
|
1293
|
-
strongDeltaDark: STRONG_DELTA_DARK,
|
|
1294
|
-
strongDeltaLight: STRONG_DELTA_LIGHT,
|
|
1295
|
-
weakDeltaDark: WEAK_DELTA_DARK,
|
|
1296
|
-
weakDeltaLight: WEAK_DELTA_LIGHT,
|
|
1297
|
-
minContrastRatio: options?.minContrastRatio,
|
|
1298
|
-
hueShift: options?.hueShift,
|
|
1299
|
-
foregroundMaxChroma: options?.foregroundMaxChroma,
|
|
1300
|
-
light: options?.light,
|
|
1301
|
-
dark: options?.dark
|
|
1302
|
-
});
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
1264
|
// src/generate/generateSemanticColors.ts
|
|
1306
1265
|
var POSITIVE_RANGE = [135, 160];
|
|
1307
1266
|
var NEGATIVE_RANGE = [5, 25];
|
|
@@ -1403,10 +1362,54 @@ function _getSplitComplementaryColors(color) {
|
|
|
1403
1362
|
];
|
|
1404
1363
|
}
|
|
1405
1364
|
|
|
1365
|
+
// src/generate/generateSurface.ts
|
|
1366
|
+
var BASELINE_DARK_L_VALUE = 0.2;
|
|
1367
|
+
var BASELINE_LIGHT_L_VALUE = 0.97;
|
|
1368
|
+
var BASELINE_MAX_CHROMA = 0.01;
|
|
1369
|
+
var STRONG_DELTA_DARK = -0.1;
|
|
1370
|
+
var STRONG_DELTA_LIGHT = 0.02;
|
|
1371
|
+
var WEAK_DELTA_DARK = 0.1;
|
|
1372
|
+
var WEAK_DELTA_LIGHT = -0.03;
|
|
1373
|
+
function generateSurface(color, themeType, options) {
|
|
1374
|
+
const invertSurfaceAndAccent = themeType === "dark" && options?.invertDarkModeSurfaceAccent;
|
|
1375
|
+
const preferredSurfaceColorInput = invertSurfaceAndAccent ? color ?? options?.surfaceColor : options?.surfaceColor ?? color;
|
|
1376
|
+
const themeAdjustments = themeType === "light" ? options?.light : options?.dark;
|
|
1377
|
+
const surfaceMaxChroma = themeAdjustments?.surfaceMaxChroma ?? options?.surfaceMaxChroma ?? BASELINE_MAX_CHROMA;
|
|
1378
|
+
const preferredSurfaceColor = convert(
|
|
1379
|
+
parse(preferredSurfaceColorInput),
|
|
1380
|
+
"oklch"
|
|
1381
|
+
);
|
|
1382
|
+
let surfaceHue = preferredSurfaceColor.h;
|
|
1383
|
+
const surfaceChroma = Math.min(preferredSurfaceColor.c, surfaceMaxChroma);
|
|
1384
|
+
const surfaceHueShift = options?.surfaceHueShift ?? 0;
|
|
1385
|
+
if (surfaceHueShift !== 0 && !options?.surfaceColor && !invertSurfaceAndAccent) {
|
|
1386
|
+
surfaceHue = wrapHue(convert(color, "oklch").h + surfaceHueShift);
|
|
1387
|
+
}
|
|
1388
|
+
const normalizedPreferredSurfaceColor = {
|
|
1389
|
+
...preferredSurfaceColor,
|
|
1390
|
+
h: surfaceHue,
|
|
1391
|
+
c: surfaceChroma,
|
|
1392
|
+
l: themeType === "light" ? BASELINE_LIGHT_L_VALUE : BASELINE_DARK_L_VALUE
|
|
1393
|
+
};
|
|
1394
|
+
return expandColorToScale(normalizedPreferredSurfaceColor, themeType, {
|
|
1395
|
+
baselineLValueDark: BASELINE_DARK_L_VALUE,
|
|
1396
|
+
baselineLValueLight: BASELINE_LIGHT_L_VALUE,
|
|
1397
|
+
strongDeltaDark: STRONG_DELTA_DARK,
|
|
1398
|
+
strongDeltaLight: STRONG_DELTA_LIGHT,
|
|
1399
|
+
weakDeltaDark: WEAK_DELTA_DARK,
|
|
1400
|
+
weakDeltaLight: WEAK_DELTA_LIGHT,
|
|
1401
|
+
minContrastRatio: options?.minContrastRatio,
|
|
1402
|
+
hueShift: options?.hueShift,
|
|
1403
|
+
foregroundMaxChroma: options?.foregroundMaxChroma,
|
|
1404
|
+
light: options?.light,
|
|
1405
|
+
dark: options?.dark
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1406
1409
|
// src/generate/generate.ts
|
|
1407
1410
|
function generate(color, themeType, options) {
|
|
1408
1411
|
return {
|
|
1409
|
-
|
|
1412
|
+
surface: generateSurface(color, themeType, options),
|
|
1410
1413
|
accent: generateAccent(color, themeType, options),
|
|
1411
1414
|
...generateSemanticColors(color, themeType, options)
|
|
1412
1415
|
};
|
|
@@ -1451,7 +1454,7 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
|
|
|
1451
1454
|
this.seedOptionsForFork({});
|
|
1452
1455
|
}
|
|
1453
1456
|
/**
|
|
1454
|
-
* Merges style options into the builder and regenerates the
|
|
1457
|
+
* Merges style options into the builder and regenerates the palettes,
|
|
1455
1458
|
* then replays recorded operations so roles and variants reflect the new style.
|
|
1456
1459
|
*/
|
|
1457
1460
|
style(partial) {
|
|
@@ -1540,7 +1543,7 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
|
|
|
1540
1543
|
*
|
|
1541
1544
|
* The color can be a direct color value or a derived token referencing an existing role.
|
|
1542
1545
|
*
|
|
1543
|
-
* e.g. `addRole('cta', '#ff0066')` adds a "cta" role with the specified
|
|
1546
|
+
* e.g. `addRole('cta', '#ff0066')` adds a "cta" role with the specified color.
|
|
1544
1547
|
* `addRole('cta', { from: 'accent', hue: 180 })` adds a "cta" role with a complementary hue to accent.
|
|
1545
1548
|
*
|
|
1546
1549
|
* @param name Role name (e.g. "cta", "banner")
|
|
@@ -1573,7 +1576,7 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
|
|
|
1573
1576
|
* `addToken('brand', { light: '#3a86ff', dark: '#ff0066' })` adds a "brand" token with different colors in light and dark themes.
|
|
1574
1577
|
*
|
|
1575
1578
|
* It can also be used to override specific tokens after generation.
|
|
1576
|
-
* `addToken('
|
|
1579
|
+
* `addToken('surface-strong', '#ff0066')` overrides the automatically generated "surface-strong" variant with a custom color.
|
|
1577
1580
|
*
|
|
1578
1581
|
* @param name Token name (e.g. "brand", "logo")
|
|
1579
1582
|
* @param value Token value, which can be an exact color, or derived from an existing role+variant.
|
|
@@ -1587,7 +1590,7 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
|
|
|
1587
1590
|
* Applies a preset that configures roles, tokens, and format defaults
|
|
1588
1591
|
* for a specific framework or convention (e.g. shadcn/ui).
|
|
1589
1592
|
*
|
|
1590
|
-
* Preset format defaults are used as
|
|
1593
|
+
* Preset format defaults are used as defaults in `.format()` — any options
|
|
1591
1594
|
* you pass to `.format()` will override the preset's defaults.
|
|
1592
1595
|
*
|
|
1593
1596
|
* @example
|
|
@@ -1628,7 +1631,7 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
|
|
|
1628
1631
|
this.operations.push({ method: "preset", args: [preset] });
|
|
1629
1632
|
this.applyPresetRolesTokensFormat(preset);
|
|
1630
1633
|
}
|
|
1631
|
-
/** Roles, variants, tokens, and format only — `this.options` and
|
|
1634
|
+
/** Roles, variants, tokens, and format only — `this.options` and palettes are already correct. */
|
|
1632
1635
|
applyPresetRolesTokensFormat(preset) {
|
|
1633
1636
|
for (const role of preset.roles ?? []) {
|
|
1634
1637
|
this.applyRole(role.name, role.color);
|
|
@@ -1697,7 +1700,7 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
|
|
|
1697
1700
|
return this;
|
|
1698
1701
|
}
|
|
1699
1702
|
/**
|
|
1700
|
-
* Creates a new builder instance with the same operations history, optionally from a different
|
|
1703
|
+
* Creates a new builder instance with the same operations history, optionally from a different accent color.
|
|
1701
1704
|
* To change style options on the fork, chain `.style()` after `.fork()`.
|
|
1702
1705
|
*
|
|
1703
1706
|
* @param color Optional new accent/brand color. If omitted, the fork uses the same color as this builder.
|
|
@@ -1938,7 +1941,9 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
|
|
|
1938
1941
|
if (this.strongSideVariants.includes(variantName)) {
|
|
1939
1942
|
return this.strongSideVariants;
|
|
1940
1943
|
}
|
|
1941
|
-
const sampleRole = Object.keys(this.lightPalette).find(
|
|
1944
|
+
const sampleRole = Object.keys(this.lightPalette).find(
|
|
1945
|
+
(r) => r !== "surface"
|
|
1946
|
+
);
|
|
1942
1947
|
if (!sampleRole) return null;
|
|
1943
1948
|
const scale = this.lightPalette[sampleRole];
|
|
1944
1949
|
if (!scale[variantName]) return null;
|
|
@@ -2102,32 +2107,32 @@ var mui = {
|
|
|
2102
2107
|
],
|
|
2103
2108
|
tokens: [
|
|
2104
2109
|
// background
|
|
2105
|
-
{ name: "background-default", value: { from: "
|
|
2110
|
+
{ name: "background-default", value: { from: "surface" } },
|
|
2106
2111
|
{
|
|
2107
2112
|
name: "background-paper",
|
|
2108
|
-
value: { from: "
|
|
2113
|
+
value: { from: "surface", emphasis: -0.025 }
|
|
2109
2114
|
},
|
|
2110
2115
|
// text
|
|
2111
|
-
{ name: "text-primary", value: { from: "
|
|
2116
|
+
{ name: "text-primary", value: { from: "surface.foreground" } },
|
|
2112
2117
|
{
|
|
2113
2118
|
name: "text-secondary",
|
|
2114
|
-
value: { from: "
|
|
2119
|
+
value: { from: "surface.foreground", emphasis: -0.2 }
|
|
2115
2120
|
},
|
|
2116
2121
|
{
|
|
2117
2122
|
name: "text-disabled",
|
|
2118
|
-
value: { from: "
|
|
2123
|
+
value: { from: "surface.foreground", emphasis: -0.4 }
|
|
2119
2124
|
},
|
|
2120
2125
|
// divider
|
|
2121
|
-
{ name: "divider", value: { from: "
|
|
2126
|
+
{ name: "divider", value: { from: "surface", emphasis: 0.12 } },
|
|
2122
2127
|
// action tokens
|
|
2123
|
-
{ name: "action-hover", value: { from: "
|
|
2124
|
-
{ name: "action-selected", value: { from: "
|
|
2125
|
-
{ name: "action-disabled", value: { from: "
|
|
2128
|
+
{ name: "action-hover", value: { from: "surface", emphasis: 0.04 } },
|
|
2129
|
+
{ name: "action-selected", value: { from: "surface", emphasis: 0.08 } },
|
|
2130
|
+
{ name: "action-disabled", value: { from: "surface", emphasis: 0.15 } },
|
|
2126
2131
|
{
|
|
2127
2132
|
name: "action-disabledBackground",
|
|
2128
|
-
value: { from: "
|
|
2133
|
+
value: { from: "surface", emphasis: 0.06 }
|
|
2129
2134
|
},
|
|
2130
|
-
{ name: "action-focus", value: { from: "
|
|
2135
|
+
{ name: "action-focus", value: { from: "surface", emphasis: 0.06 } }
|
|
2131
2136
|
],
|
|
2132
2137
|
format: {
|
|
2133
2138
|
as: "object",
|
|
@@ -2144,7 +2149,7 @@ var mui = {
|
|
|
2144
2149
|
strong: "dark",
|
|
2145
2150
|
foreground: "contrastText"
|
|
2146
2151
|
},
|
|
2147
|
-
excludeRoles: ["
|
|
2152
|
+
excludeRoles: ["surface"]
|
|
2148
2153
|
}
|
|
2149
2154
|
};
|
|
2150
2155
|
|
|
@@ -2153,7 +2158,7 @@ var muted = {
|
|
|
2153
2158
|
style: {
|
|
2154
2159
|
light: { maxChroma: 0.08 },
|
|
2155
2160
|
dark: { maxChroma: 0.07 },
|
|
2156
|
-
|
|
2161
|
+
surfaceMaxChroma: 5e-3,
|
|
2157
2162
|
foregroundMaxChroma: 5e-3
|
|
2158
2163
|
}
|
|
2159
2164
|
};
|
|
@@ -2162,36 +2167,36 @@ var muted = {
|
|
|
2162
2167
|
var shadcn = {
|
|
2163
2168
|
tokens: [
|
|
2164
2169
|
// shadcn uses bare --foreground (not --background-foreground)
|
|
2165
|
-
{ name: "foreground", value: { from: "
|
|
2170
|
+
{ name: "foreground", value: { from: "surface.foreground" } },
|
|
2166
2171
|
// card / popover — same as background
|
|
2167
|
-
{ name: "card", value: { from: "
|
|
2168
|
-
{ name: "card-foreground", value: { from: "
|
|
2169
|
-
{ name: "popover", value: { from: "
|
|
2170
|
-
{ name: "popover-foreground", value: { from: "
|
|
2172
|
+
{ name: "card", value: { from: "surface" } },
|
|
2173
|
+
{ name: "card-foreground", value: { from: "surface.foreground" } },
|
|
2174
|
+
{ name: "popover", value: { from: "surface" } },
|
|
2175
|
+
{ name: "popover-foreground", value: { from: "surface.foreground" } },
|
|
2171
2176
|
// secondary — subtle contrast from background
|
|
2172
|
-
{ name: "secondary", value: { from: "
|
|
2173
|
-
{ name: "secondary-foreground", value: { from: "
|
|
2177
|
+
{ name: "secondary", value: { from: "surface" } },
|
|
2178
|
+
{ name: "secondary-foreground", value: { from: "surface.foreground" } },
|
|
2174
2179
|
// muted — similar to secondary, but with dimmer foreground
|
|
2175
|
-
{ name: "muted", value: { from: "
|
|
2180
|
+
{ name: "muted", value: { from: "surface" } },
|
|
2176
2181
|
{
|
|
2177
2182
|
name: "muted-foreground",
|
|
2178
2183
|
value: {
|
|
2179
|
-
from: "
|
|
2184
|
+
from: "surface.foreground",
|
|
2180
2185
|
emphasis: -0.25
|
|
2181
2186
|
}
|
|
2182
2187
|
},
|
|
2183
2188
|
// accent (shadcn meaning: subtle hover highlight, not the brand color)
|
|
2184
|
-
{ name: "accent", value: { from: "
|
|
2185
|
-
{ name: "accent-foreground", value: { from: "
|
|
2189
|
+
{ name: "accent", value: { from: "surface" } },
|
|
2190
|
+
{ name: "accent-foreground", value: { from: "surface.foreground" } },
|
|
2186
2191
|
// border / input
|
|
2187
2192
|
{
|
|
2188
2193
|
name: "border",
|
|
2189
|
-
value: { from: "
|
|
2194
|
+
value: { from: "surface", emphasis: 0.8 }
|
|
2190
2195
|
},
|
|
2191
2196
|
{
|
|
2192
2197
|
name: "input",
|
|
2193
2198
|
value: {
|
|
2194
|
-
from: "
|
|
2199
|
+
from: "surface",
|
|
2195
2200
|
emphasis: 0.8
|
|
2196
2201
|
}
|
|
2197
2202
|
},
|
|
@@ -2208,7 +2213,7 @@ var shadcn = {
|
|
|
2208
2213
|
as: "css",
|
|
2209
2214
|
colors: "oklch",
|
|
2210
2215
|
roleNames: {
|
|
2211
|
-
|
|
2216
|
+
surface: "background",
|
|
2212
2217
|
accent: "primary",
|
|
2213
2218
|
negative: "destructive",
|
|
2214
2219
|
positive: "success"
|
|
@@ -2224,8 +2229,8 @@ var shadcn = {
|
|
|
2224
2229
|
// src/presets/tinted.ts
|
|
2225
2230
|
var tinted = {
|
|
2226
2231
|
style: {
|
|
2227
|
-
|
|
2228
|
-
|
|
2232
|
+
surfaceMaxChroma: 0.05,
|
|
2233
|
+
surfaceHueShift: 0,
|
|
2229
2234
|
foregroundMaxChroma: 0.015
|
|
2230
2235
|
}
|
|
2231
2236
|
};
|
|
@@ -2236,8 +2241,8 @@ var vibrant = {
|
|
|
2236
2241
|
light: { maxChroma: 0.2, lightness: 0.6 },
|
|
2237
2242
|
dark: { maxChroma: 0.18, lightness: 0.65 },
|
|
2238
2243
|
hueShift: 5,
|
|
2239
|
-
|
|
2240
|
-
|
|
2244
|
+
surfaceHueShift: 180,
|
|
2245
|
+
surfaceMaxChroma: 0.08
|
|
2241
2246
|
}
|
|
2242
2247
|
};
|
|
2243
2248
|
|
|
@@ -2300,17 +2305,17 @@ Format options:
|
|
|
2300
2305
|
--exclude-variant <name> Omit a variant from output (repeatable)
|
|
2301
2306
|
|
|
2302
2307
|
Style options:
|
|
2303
|
-
--
|
|
2304
|
-
--
|
|
2308
|
+
--surface-color <color> Override surface/neutral color
|
|
2309
|
+
--surface-hue-shift <deg> Rotate surface hue relative to accent
|
|
2305
2310
|
--hue-shift <deg> Per-variant hue shift in degrees
|
|
2306
|
-
--
|
|
2311
|
+
--surface-max-chroma <n> Max chroma for surface colors (default: 0.01)
|
|
2307
2312
|
--fg-max-chroma <n> Max chroma for foreground colors (default: 0.01)
|
|
2308
2313
|
--light-lightness <n> Light theme lightness 0-1 (default: 0.7)
|
|
2309
2314
|
--light-max-chroma <n> Light theme max chroma
|
|
2310
2315
|
--dark-lightness <n> Dark theme lightness 0-1 (default: 0.6)
|
|
2311
2316
|
--dark-max-chroma <n> Dark theme max chroma
|
|
2312
2317
|
--min-contrast <value> AAA | AA | <number> (default: AAA)
|
|
2313
|
-
--invert-dark Swap
|
|
2318
|
+
--invert-dark Swap surface/accent hues in dark mode (requires --surface-color)
|
|
2314
2319
|
|
|
2315
2320
|
Semantic colors:
|
|
2316
2321
|
--positive <color> Override positive/success color (default: auto green)
|
|
@@ -2340,7 +2345,7 @@ Examples:
|
|
|
2340
2345
|
hextimator '#6366F1' --preset muted --preset shadcn
|
|
2341
2346
|
hextimator '#6366F1' --preset shadcn --colors hsl-raw
|
|
2342
2347
|
hextimator '#22aa44' --role cta=#ee2244 --variant hover:from:strong -o theme.css
|
|
2343
|
-
hextimator '#6A5ACD' --
|
|
2348
|
+
hextimator '#6A5ACD' --surface-color '#FEBA5D' --invert-dark
|
|
2344
2349
|
hextimator '#ff6600' --simulate deuteranopia
|
|
2345
2350
|
hextimator '#ff6600' --adapt deuteranopia --cvd-severity 0.8
|
|
2346
2351
|
`.trim();
|
|
@@ -2357,10 +2362,10 @@ function run() {
|
|
|
2357
2362
|
separator: { type: "string" },
|
|
2358
2363
|
"exclude-role": { type: "string", multiple: true },
|
|
2359
2364
|
"exclude-variant": { type: "string", multiple: true },
|
|
2360
|
-
"
|
|
2361
|
-
"
|
|
2365
|
+
"surface-color": { type: "string" },
|
|
2366
|
+
"surface-hue-shift": { type: "string" },
|
|
2362
2367
|
"hue-shift": { type: "string" },
|
|
2363
|
-
"
|
|
2368
|
+
"surface-max-chroma": { type: "string" },
|
|
2364
2369
|
"fg-max-chroma": { type: "string" },
|
|
2365
2370
|
"light-lightness": { type: "string" },
|
|
2366
2371
|
"light-max-chroma": { type: "string" },
|
|
@@ -2395,12 +2400,13 @@ function run() {
|
|
|
2395
2400
|
process.exit(1);
|
|
2396
2401
|
}
|
|
2397
2402
|
const styleOptions = {};
|
|
2398
|
-
if (values["
|
|
2399
|
-
|
|
2400
|
-
|
|
2403
|
+
if (values["surface-color"])
|
|
2404
|
+
styleOptions.surfaceColor = values["surface-color"];
|
|
2405
|
+
if (values["surface-hue-shift"])
|
|
2406
|
+
styleOptions.surfaceHueShift = Number(values["surface-hue-shift"]);
|
|
2401
2407
|
if (values["hue-shift"]) styleOptions.hueShift = Number(values["hue-shift"]);
|
|
2402
|
-
if (values["
|
|
2403
|
-
styleOptions.
|
|
2408
|
+
if (values["surface-max-chroma"])
|
|
2409
|
+
styleOptions.surfaceMaxChroma = Number(values["surface-max-chroma"]);
|
|
2404
2410
|
if (values["fg-max-chroma"])
|
|
2405
2411
|
styleOptions.foregroundMaxChroma = Number(values["fg-max-chroma"]);
|
|
2406
2412
|
if (values["light-lightness"] || values["light-max-chroma"]) {
|
|
@@ -2426,7 +2432,7 @@ function run() {
|
|
|
2426
2432
|
}
|
|
2427
2433
|
}
|
|
2428
2434
|
if (values["invert-dark"]) {
|
|
2429
|
-
styleOptions.
|
|
2435
|
+
styleOptions.invertDarkModeSurfaceAccent = true;
|
|
2430
2436
|
}
|
|
2431
2437
|
const semanticColors = {};
|
|
2432
2438
|
if (values.positive) semanticColors.positive = values.positive;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { h as HextimatePreset } from './HextimatePaletteBuilder-BH1jrzj7.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Darker accents on light themes, lighter accents on dark themes.
|
|
5
|
+
* Higher chroma for neutrals.
|
|
6
|
+
*/
|
|
7
|
+
declare const bold: HextimatePreset;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Preset for Material UI (MUI) projects.
|
|
11
|
+
*
|
|
12
|
+
* Generates palette tokens matching MUI's theme structure:
|
|
13
|
+
* `primary`, `secondary`, `error`, `warning`, `info`, `success` —
|
|
14
|
+
* each with `main`, `light`, `dark`, and `contrastText` variants.
|
|
15
|
+
*
|
|
16
|
+
* Also generates `background` (`default`, `paper`), `text` (`primary`,
|
|
17
|
+
* `secondary`, `disabled`), `divider`, and `action` tokens.
|
|
18
|
+
*
|
|
19
|
+
* Defaults to `object` format for use with `createTheme()`. Override with
|
|
20
|
+
* `.format({ as: 'css' })` for MUI's CSS variables mode.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* import { hextimate, presets } from 'hextimator';
|
|
24
|
+
* import { createTheme } from '@mui/material/styles';
|
|
25
|
+
*
|
|
26
|
+
* const palette = hextimate('#6366F1')
|
|
27
|
+
* .preset(presets.mui)
|
|
28
|
+
* .format();
|
|
29
|
+
*
|
|
30
|
+
* const theme = createTheme({ palette: palette.light });
|
|
31
|
+
*/
|
|
32
|
+
declare const mui: HextimatePreset;
|
|
33
|
+
|
|
34
|
+
/** Desaturated, restrained palette. Low chroma across the board. */
|
|
35
|
+
declare const muted: HextimatePreset;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Preset for shadcn/ui projects.
|
|
39
|
+
*
|
|
40
|
+
* Generates all CSS variables that shadcn/ui components expect:
|
|
41
|
+
* `--background`, `--foreground`, `--primary`, `--secondary`, `--muted`,
|
|
42
|
+
* `--accent`, `--destructive`, `--card`, `--popover`, `--border`, `--input`, `--ring`,
|
|
43
|
+
* plus their `-foreground` counterparts.
|
|
44
|
+
*
|
|
45
|
+
* Defaults to `oklch` color format (modern shadcn). Override with
|
|
46
|
+
* `.format({ colors: 'hsl-raw' })` for older shadcn setups.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* import { hextimate, presets } from 'hextimator';
|
|
50
|
+
*
|
|
51
|
+
* const theme = hextimate('#6366F1')
|
|
52
|
+
* .preset(presets.shadcn)
|
|
53
|
+
* .format();
|
|
54
|
+
*
|
|
55
|
+
* // Use with React hook:
|
|
56
|
+
* const palette = useHextimator('#6366F1', {
|
|
57
|
+
* configure: (b) => b.preset(presets.shadcn),
|
|
58
|
+
* });
|
|
59
|
+
*/
|
|
60
|
+
declare const shadcn: HextimatePreset;
|
|
61
|
+
|
|
62
|
+
/** Neutrals pick up the accent hue for a cohesive, branded feel. */
|
|
63
|
+
declare const tinted: HextimatePreset;
|
|
64
|
+
|
|
65
|
+
/** High-saturation palette. Colors that pop. */
|
|
66
|
+
declare const vibrant: HextimatePreset;
|
|
67
|
+
|
|
68
|
+
declare const index_HextimatePreset: typeof HextimatePreset;
|
|
69
|
+
declare const index_bold: typeof bold;
|
|
70
|
+
declare const index_mui: typeof mui;
|
|
71
|
+
declare const index_muted: typeof muted;
|
|
72
|
+
declare const index_shadcn: typeof shadcn;
|
|
73
|
+
declare const index_tinted: typeof tinted;
|
|
74
|
+
declare const index_vibrant: typeof vibrant;
|
|
75
|
+
declare namespace index {
|
|
76
|
+
export { index_HextimatePreset as HextimatePreset, index_bold as bold, index_mui as mui, index_muted as muted, index_shadcn as shadcn, index_tinted as tinted, index_vibrant as vibrant };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { muted as a, bold as b, index as i, mui as m, shadcn as s, tinted as t, vibrant as v };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { C as Color, a as CVDType, O as OKLCH, b as ColorSpace, c as ColorInSpace, d as ColorInput, H as
|
|
2
|
-
export { D as DerivedToken, F as FlatTokenMap,
|
|
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-BH1jrzj7.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-BH1jrzj7.js';
|
|
3
|
+
export { i as presets } from './index-Cd9eX-1l.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Daltonize a color for a specific type of color vision deficiency (CVD).
|
|
@@ -63,82 +64,6 @@ declare function convert<S extends ColorSpace>(color: Color, to: S): ColorInSpac
|
|
|
63
64
|
*/
|
|
64
65
|
declare function parse(input: ColorInput, assumeSpace?: ColorSpace): Color;
|
|
65
66
|
|
|
66
|
-
/**
|
|
67
|
-
* Darker accents on light themes, lighter accents on dark themes.
|
|
68
|
-
* Higher chroma for neutrals.
|
|
69
|
-
*/
|
|
70
|
-
declare const bold: HextimatePreset;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Preset for Material UI (MUI) projects.
|
|
74
|
-
*
|
|
75
|
-
* Generates palette tokens matching MUI's theme structure:
|
|
76
|
-
* `primary`, `secondary`, `error`, `warning`, `info`, `success` —
|
|
77
|
-
* each with `main`, `light`, `dark`, and `contrastText` variants.
|
|
78
|
-
*
|
|
79
|
-
* Also generates `background` (`default`, `paper`), `text` (`primary`,
|
|
80
|
-
* `secondary`, `disabled`), `divider`, and `action` tokens.
|
|
81
|
-
*
|
|
82
|
-
* Defaults to `object` format for use with `createTheme()`. Override with
|
|
83
|
-
* `.format({ as: 'css' })` for MUI's CSS variables mode.
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* import { hextimate, presets } from 'hextimator';
|
|
87
|
-
* import { createTheme } from '@mui/material/styles';
|
|
88
|
-
*
|
|
89
|
-
* const palette = hextimate('#6366F1')
|
|
90
|
-
* .preset(presets.mui)
|
|
91
|
-
* .format();
|
|
92
|
-
*
|
|
93
|
-
* const theme = createTheme({ palette: palette.light });
|
|
94
|
-
*/
|
|
95
|
-
declare const mui: HextimatePreset;
|
|
96
|
-
|
|
97
|
-
/** Desaturated, restrained palette. Low chroma across the board. */
|
|
98
|
-
declare const muted: HextimatePreset;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Preset for shadcn/ui projects.
|
|
102
|
-
*
|
|
103
|
-
* Generates all CSS variables that shadcn/ui components expect:
|
|
104
|
-
* `--background`, `--foreground`, `--primary`, `--secondary`, `--muted`,
|
|
105
|
-
* `--accent`, `--destructive`, `--card`, `--popover`, `--border`, `--input`, `--ring`,
|
|
106
|
-
* plus their `-foreground` counterparts.
|
|
107
|
-
*
|
|
108
|
-
* Defaults to `oklch` color format (modern shadcn). Override with
|
|
109
|
-
* `.format({ colors: 'hsl-raw' })` for older shadcn setups.
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* import { hextimate, presets } from 'hextimator';
|
|
113
|
-
*
|
|
114
|
-
* const theme = hextimate('#6366F1')
|
|
115
|
-
* .preset(presets.shadcn)
|
|
116
|
-
* .format();
|
|
117
|
-
*
|
|
118
|
-
* // Use with React hook:
|
|
119
|
-
* const palette = useHextimator('#6366F1', {
|
|
120
|
-
* configure: (b) => b.preset(presets.shadcn),
|
|
121
|
-
* });
|
|
122
|
-
*/
|
|
123
|
-
declare const shadcn: HextimatePreset;
|
|
124
|
-
|
|
125
|
-
/** Neutrals pick up the accent hue for a cohesive, branded feel. */
|
|
126
|
-
declare const tinted: HextimatePreset;
|
|
127
|
-
|
|
128
|
-
/** High-saturation palette. Colors that pop. */
|
|
129
|
-
declare const vibrant: HextimatePreset;
|
|
130
|
-
|
|
131
|
-
declare const index_HextimatePreset: typeof HextimatePreset;
|
|
132
|
-
declare const index_bold: typeof bold;
|
|
133
|
-
declare const index_mui: typeof mui;
|
|
134
|
-
declare const index_muted: typeof muted;
|
|
135
|
-
declare const index_shadcn: typeof shadcn;
|
|
136
|
-
declare const index_tinted: typeof tinted;
|
|
137
|
-
declare const index_vibrant: typeof vibrant;
|
|
138
|
-
declare namespace index {
|
|
139
|
-
export { index_HextimatePreset as HextimatePreset, index_bold as bold, index_mui as mui, index_muted as muted, index_shadcn as shadcn, index_tinted as tinted, index_vibrant as vibrant };
|
|
140
|
-
}
|
|
141
|
-
|
|
142
67
|
/** Thrown when `hextimate()` fails to parse or generate a palette from the given input. */
|
|
143
68
|
declare class HextimateError extends Error {
|
|
144
69
|
readonly input: ColorInput;
|
|
@@ -162,4 +87,4 @@ declare class HextimateError extends Error {
|
|
|
162
87
|
*/
|
|
163
88
|
declare function hextimate(color: ColorInput): HextimatePaletteBuilder;
|
|
164
89
|
|
|
165
|
-
export { CVDType, HextimateError, HextimatePaletteBuilder,
|
|
90
|
+
export { CVDType, HextimateError, HextimatePaletteBuilder, convert as convertColor, daltonizeColor, hextimate, parse as parseColor, simulateColor };
|
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-
|
|
9
|
+
} from "./chunk-QQZBI4SO.js";
|
|
10
|
+
import {
|
|
11
|
+
presets_exports
|
|
12
|
+
} from "./chunk-KFR2LTS2.js";
|
|
11
13
|
export {
|
|
12
14
|
HextimateError,
|
|
13
15
|
HextimatePaletteBuilder,
|
package/dist/presets.js
ADDED
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as HextimateStyleOptions,
|
|
1
|
+
import { j as HextimateStyleOptions, h as HextimatePreset, H as HextimatePaletteBuilder, i as HextimateResult, F as FlatTokenMap, f as HextimateFormatOptions } from './HextimatePaletteBuilder-BH1jrzj7.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>;
|