hextimator 0.14.4 → 0.15.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.
@@ -1,3 +1,17 @@
1
+ import {
2
+ __export,
3
+ baseTheme,
4
+ boldTheme,
5
+ generatedRoles,
6
+ isGeneratedRole,
7
+ isGeneratedToken,
8
+ muiTheme,
9
+ mutedTheme,
10
+ shadcnTheme,
11
+ tintedTheme,
12
+ vibrantTheme
13
+ } from "./chunk-Q6KJLMLM.js";
14
+
1
15
  // src/convert/matrices.ts
2
16
  var M1 = [
3
17
  [0.4122214708, 0.5363325363, 0.0514459929],
@@ -899,8 +913,8 @@ ${declsFromEntries(lightEntries, sep, "--", " ")}
899
913
  const rootDarkBlock = `${selector} {
900
914
  ${declsFromEntries(darkEntries, sep, "--", " ")}
901
915
  }`;
902
- if (theme === "light") return lightBlock;
903
916
  if (theme === "dark") return rootDarkBlock;
917
+ if (theme === "light" || darkMode === false) return lightBlock;
904
918
  if (darkMode === "media") {
905
919
  const darkInner = declsFromEntries(darkEntries, sep, "--", " ");
906
920
  return `${lightBlock}
@@ -924,7 +938,7 @@ function formatTailwindStylesheet(lightEntries, darkEntries, sep, opts = {}) {
924
938
  const theme = `@theme {
925
939
  ${declsFromEntries(themeEntries, sep, "--color-", " ")}
926
940
  }`;
927
- if (selectedTheme !== "both") return theme;
941
+ if (selectedTheme !== "both" || darkMode === false) return theme;
928
942
  if (darkMode === "media") {
929
943
  const darkInner = declsFromEntries(darkEntries, sep, "--color-", " ");
930
944
  return `${theme}
@@ -1677,16 +1691,84 @@ function generateSurface(color, themeType, options) {
1677
1691
  }
1678
1692
 
1679
1693
  // src/generate/generate.ts
1680
- function generate(color, themeType, options) {
1694
+ var GeneratePaletteError = class extends Error {
1695
+ constructor(message) {
1696
+ super(message);
1697
+ this.name = "GeneratePaletteError";
1698
+ }
1699
+ };
1700
+ var DEFAULT_ROLES = [
1701
+ { name: "surface", generate: "surface" },
1702
+ { name: "accent", generate: "accent" },
1703
+ { name: "positive", generate: "positive" },
1704
+ { name: "negative", generate: "negative" },
1705
+ { name: "caution", generate: "caution" }
1706
+ ];
1707
+ function generate(color, themeType, options, roles = DEFAULT_ROLES) {
1708
+ if (roles.filter((r) => r.generate === "surface").length > 1) {
1709
+ throw new GeneratePaletteError(
1710
+ "A theme can declare only one surface role."
1711
+ );
1712
+ }
1681
1713
  const resolvedOptions = {
1682
1714
  ...options ?? {},
1683
1715
  inputLightness: convert(color, "oklch").l
1684
1716
  };
1685
- return {
1686
- surface: generateSurface(color, themeType, resolvedOptions),
1687
- accent: generateAccent(color, themeType, resolvedOptions),
1688
- ...generateSemanticColors(color, themeType, resolvedOptions)
1689
- };
1717
+ let semantic;
1718
+ const palette = {};
1719
+ for (const { name, generate: kind } of roles) {
1720
+ if (kind === "surface") {
1721
+ palette[name] = generateSurface(color, themeType, resolvedOptions);
1722
+ } else if (kind === "accent") {
1723
+ palette[name] = generateAccent(color, themeType, resolvedOptions);
1724
+ } else {
1725
+ semantic ??= generateSemanticColors(color, themeType, resolvedOptions);
1726
+ palette[name] = { ...semantic[kind] };
1727
+ }
1728
+ }
1729
+ return palette;
1730
+ }
1731
+
1732
+ // src/generate/surfaceForegrounds.ts
1733
+ var SURFACE_VARIANTS = ["DEFAULT", "weak", "strong"];
1734
+ function isRoleForeground({ surface, roles }, role, variant) {
1735
+ return role === surface && roles.some((r) => variant === `foreground-${r}`);
1736
+ }
1737
+ function solveContrast(base, surfaces, target) {
1738
+ const withL = (l) => ({ ...base, l, alpha: 1 });
1739
+ const contrast = (color) => Math.min(...surfaces.map((surface) => calculateContrast(color, surface)));
1740
+ const endpointL = contrast(withL(0)) >= contrast(withL(1)) ? 0 : 1;
1741
+ const bufferedTarget = Math.min(
1742
+ target + CONTRAST_MARGIN,
1743
+ contrast(withL(endpointL))
1744
+ );
1745
+ let fail = 1 - endpointL;
1746
+ let pass = endpointL;
1747
+ for (let i = 0; i < 24; i++) {
1748
+ const mid = (fail + pass) / 2;
1749
+ if (contrast(withL(mid)) >= bufferedTarget) pass = mid;
1750
+ else fail = mid;
1751
+ }
1752
+ return convert(convert(withL(pass), "srgb"), "oklch");
1753
+ }
1754
+ function surfaceForegrounds(palette, theme, options, { surface: surfaceRole, roles }) {
1755
+ if (!surfaceRole || !palette[surfaceRole]) return palette;
1756
+ const target = resolveContrastRatio(
1757
+ resolveMergedThemeAdjustments(theme, options).minContrastRatio
1758
+ );
1759
+ const surfaces = SURFACE_VARIANTS.map(
1760
+ (variant) => parse(palette[surfaceRole][variant])
1761
+ );
1762
+ const surface = { ...palette[surfaceRole] };
1763
+ for (const role of roles) {
1764
+ if (!palette[role]) continue;
1765
+ surface[`foreground-${role}`] = solveContrast(
1766
+ convert(parse(palette[role].DEFAULT), "oklch"),
1767
+ surfaces,
1768
+ target
1769
+ );
1770
+ }
1771
+ return { ...palette, [surfaceRole]: surface };
1690
1772
  }
1691
1773
 
1692
1774
  // src/HextimatePaletteBuilder.ts
@@ -1715,22 +1797,29 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
1715
1797
  lightPalette;
1716
1798
  darkPalette;
1717
1799
  inputColor;
1800
+ theme;
1718
1801
  options;
1719
1802
  operations = [];
1720
1803
  standaloneTokens = [];
1804
+ foregroundOverrides = /* @__PURE__ */ new Map();
1805
+ pinnedCoordinates = /* @__PURE__ */ new Set();
1721
1806
  weakSideVariants = ["weak"];
1722
1807
  strongSideVariants = ["strong"];
1723
1808
  foregroundAnchoredVariants = /* @__PURE__ */ new Set();
1724
1809
  betweenVariants = [];
1725
1810
  presetFormatDefaults;
1726
- constructor(color) {
1811
+ constructor(color, theme = baseTheme) {
1727
1812
  this.inputColor = color;
1813
+ this.theme = theme;
1728
1814
  this.options = {};
1729
- this.seedOptionsForFork({});
1815
+ this.seedOptionsForFork(mergeStyleOptions(theme.style));
1730
1816
  }
1731
1817
  /**
1732
1818
  * Merges style options into the builder and regenerates the palettes,
1733
1819
  * then replays recorded operations so roles and variants reflect the new style.
1820
+ *
1821
+ * @deprecated Set `style` on a `ThemeDefinition`: `hextimate(accent, { ...theme, style })`.
1822
+ * See the {@link https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md#014x--0150-themes | Migration guide}.
1734
1823
  */
1735
1824
  style(partial) {
1736
1825
  this.operations.push({ method: "style", args: [partial] });
@@ -1740,17 +1829,22 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
1740
1829
  }
1741
1830
  seedOptionsForFork(seededOptions) {
1742
1831
  this.options = { ...seededOptions };
1832
+ const roles = generatedRoles(this.theme);
1743
1833
  this.lightPalette = generate(
1744
1834
  this.inputColor,
1745
1835
  "light",
1746
- this.resolvedOptions()
1836
+ this.resolvedOptions(),
1837
+ roles
1747
1838
  );
1748
1839
  this.darkPalette = generate(
1749
1840
  this.inputColor,
1750
1841
  "dark",
1751
- this.resolvedOptions()
1842
+ this.resolvedOptions(),
1843
+ roles
1752
1844
  );
1753
1845
  this.standaloneTokens.length = 0;
1846
+ this.foregroundOverrides.clear();
1847
+ this.pinnedCoordinates.clear();
1754
1848
  this.weakSideVariants.length = 0;
1755
1849
  this.weakSideVariants.push("weak");
1756
1850
  this.strongSideVariants.length = 0;
@@ -1758,12 +1852,45 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
1758
1852
  this.foregroundAnchoredVariants.clear();
1759
1853
  this.betweenVariants.length = 0;
1760
1854
  this.presetFormatDefaults = void 0;
1761
- this.applyToken("brand-exact", this.inputColor);
1855
+ this.applyTheme();
1856
+ }
1857
+ /** Custom roles, variants, tokens, and format defaults from the theme. Generated roles already exist. */
1858
+ applyTheme() {
1859
+ const theme = this.theme;
1860
+ for (const [name, role] of Object.entries(theme.roles ?? {})) {
1861
+ if (isGeneratedRole(role)) continue;
1862
+ this.applyRole(name, "color" in role ? role.color : role);
1863
+ }
1864
+ for (const variant of theme.variants ?? []) {
1865
+ this.applyVariant(variant.name, variant.placement);
1866
+ }
1867
+ for (const token of theme.tokens ?? []) {
1868
+ this.applyToken(token.name, this.resolveThemeToken(token.value));
1869
+ }
1870
+ if (theme.format || theme.variantNames) {
1871
+ this.presetFormatDefaults = {
1872
+ ...theme.format,
1873
+ variantNames: { ...theme.format?.variantNames, ...theme.variantNames }
1874
+ };
1875
+ }
1876
+ }
1877
+ resolveThemeToken(value) {
1878
+ if (!isGeneratedToken(value)) return value;
1879
+ if (value.generate === "brand-exact") return this.inputColor;
1762
1880
  const colorOKLCH = convert(this.inputColor, "oklch");
1763
1881
  const lightFg = { ...colorOKLCH, l: 0.97, c: Math.min(colorOKLCH.c, 0.01) };
1764
1882
  const darkFg = { ...colorOKLCH, l: 0.1, c: Math.min(colorOKLCH.c, 0.01) };
1765
- const brandForeground = calculateContrast(this.inputColor, lightFg) >= calculateContrast(this.inputColor, darkFg) ? lightFg : darkFg;
1766
- this.applyToken("brand-exact-foreground", brandForeground);
1883
+ return calculateContrast(this.inputColor, lightFg) >= calculateContrast(this.inputColor, darkFg) ? lightFg : darkFg;
1884
+ }
1885
+ /** Every role the theme declares gets colored text on its surface role. */
1886
+ surfaceForegroundRoles() {
1887
+ const surface = generatedRoles(this.theme).find(
1888
+ (r) => r.generate === "surface"
1889
+ )?.name;
1890
+ return {
1891
+ surface,
1892
+ roles: Object.keys(this.theme.roles ?? {}).filter((r) => r !== surface)
1893
+ };
1767
1894
  }
1768
1895
  rebuildFromOperations() {
1769
1896
  this.seedOptionsForFork(this.options);
@@ -1824,6 +1951,8 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
1824
1951
  *
1825
1952
  * @param name Role name (e.g. "cta", "banner")
1826
1953
  * @param color Base color or derived token for the role
1954
+ * @deprecated Declare the role in a `ThemeDefinition`: `roles: { cta: { color: '#ff0066' } }`.
1955
+ * See the {@link https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md#014x--0150-themes | Migration guide}.
1827
1956
  */
1828
1957
  addRole(name, color) {
1829
1958
  this.operations.push({ method: "addRole", args: [name, color] });
@@ -1838,6 +1967,8 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
1838
1967
  *
1839
1968
  * @param name Variant name (e.g. "placeholder", "highlight")
1840
1969
  * @param placement Placement of the variant, either `{ from: 'weak' }` or `{ between: ['DEFAULT', 'strong'] }`
1970
+ * @deprecated Declare the variant in a `ThemeDefinition`: `variants: [{ name, placement }]`.
1971
+ * See the {@link https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md#014x--0150-themes | Migration guide}.
1841
1972
  */
1842
1973
  addVariant(name, placement) {
1843
1974
  this.operations.push({ method: "addVariant", args: [name, placement] });
@@ -1849,6 +1980,9 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
1849
1980
  *
1850
1981
  * Override with a dotted key: `surface.weak`, `surface.DEFAULT` (not `surface-weak`).
1851
1982
  * A kebab key that matches a generated label throws at format time.
1983
+ *
1984
+ * @deprecated Declare the token in a `ThemeDefinition`: `tokens: [{ name, value }]`.
1985
+ * See the {@link https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md#014x--0150-themes | Migration guide}.
1852
1986
  */
1853
1987
  addToken(name, value) {
1854
1988
  this.operations.push({ method: "addToken", args: [name, value] });
@@ -1873,21 +2007,16 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
1873
2007
  * const theme = hextimate('#6366F1')
1874
2008
  * .preset(presets.shadcn)
1875
2009
  * .format({ colors: 'hsl-raw' });
2010
+ *
2011
+ * @deprecated Pass a `ThemeDefinition`: `hextimate(accent, themes.shadcn)`.
2012
+ * See the {@link https://github.com/fgrgic/hextimator/blob/main/packages/hextimator/docs/migration.md#014x--0150-themes | Migration guide}.
1876
2013
  */
1877
2014
  preset(preset) {
1878
2015
  this.operations.push({ method: "preset", args: [preset] });
1879
2016
  if (preset.style) {
1880
2017
  this.options = mergeStyleOptions(this.options, preset.style);
1881
- this.lightPalette = generate(
1882
- this.inputColor,
1883
- "light",
1884
- this.resolvedOptions()
1885
- );
1886
- this.darkPalette = generate(
1887
- this.inputColor,
1888
- "dark",
1889
- this.resolvedOptions()
1890
- );
2018
+ this.rebuildFromOperations();
2019
+ return this;
1891
2020
  }
1892
2021
  this.applyPresetRolesTokensFormat(preset);
1893
2022
  return this;
@@ -1976,7 +2105,7 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
1976
2105
  */
1977
2106
  fork(color) {
1978
2107
  const newColor = color !== void 0 ? parse(color) : this.inputColor;
1979
- const builder = new _HextimatePaletteBuilder(newColor);
2108
+ const builder = new _HextimatePaletteBuilder(newColor, this.theme);
1980
2109
  builder.seedOptionsForFork({ ...this.options });
1981
2110
  for (const op of this.operations) {
1982
2111
  switch (op.method) {
@@ -2017,43 +2146,51 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
2017
2146
  ...options?.variantNames
2018
2147
  }
2019
2148
  } : options;
2149
+ const lightPalette = this.outputPalette("light");
2150
+ const darkPalette = this.outputPalette("dark");
2020
2151
  const colorFormat = mergedOptions?.colors ?? "hex";
2021
- this.assertNoPaletteLabelCollisions(mergedOptions);
2152
+ this.assertNoPaletteLabelCollisions(mergedOptions, lightPalette);
2022
2153
  const lightTokens = this.resolveStandaloneTokens(
2023
2154
  "light",
2024
- this.lightPalette,
2155
+ lightPalette,
2025
2156
  colorFormat
2026
2157
  );
2027
2158
  const darkTokens = this.resolveStandaloneTokens(
2028
2159
  "dark",
2029
- this.darkPalette,
2160
+ darkPalette,
2030
2161
  colorFormat
2031
2162
  );
2032
- const inverted = mergedOptions?.invertedVariants ? this.buildInvertedEntries(mergedOptions, lightTokens, darkTokens) : { lightBlock: [], darkBlock: [] };
2163
+ const inverted = mergedOptions?.invertedVariants ? this.buildInvertedEntries(
2164
+ mergedOptions,
2165
+ lightTokens,
2166
+ darkTokens,
2167
+ lightPalette,
2168
+ darkPalette
2169
+ ) : { lightBlock: [], darkBlock: [] };
2033
2170
  if (mergedOptions?.as === "css" || mergedOptions?.as === "tailwind-css") {
2034
2171
  return formatStylesheet(
2035
- this.lightPalette,
2036
- this.darkPalette,
2172
+ lightPalette,
2173
+ darkPalette,
2037
2174
  mergedOptions,
2038
2175
  [...lightTokens, ...inverted.lightBlock],
2039
2176
  [...darkTokens, ...inverted.darkBlock]
2040
2177
  );
2041
2178
  }
2042
2179
  return {
2043
- light: format(this.lightPalette, mergedOptions, [
2180
+ light: format(lightPalette, mergedOptions, [
2044
2181
  ...lightTokens,
2045
2182
  ...inverted.lightBlock
2046
2183
  ]),
2047
- dark: format(this.darkPalette, mergedOptions, [
2184
+ dark: format(darkPalette, mergedOptions, [
2048
2185
  ...darkTokens,
2049
2186
  ...inverted.darkBlock
2050
2187
  ])
2051
2188
  };
2052
2189
  }
2053
- buildInvertedEntries(options, lightStandalone, darkStandalone) {
2190
+ buildInvertedEntries(options, lightStandalone, darkStandalone, lightPalette, darkPalette) {
2054
2191
  const sep = options.separator ?? "-";
2055
- const lightBase = buildTokenEntries(this.lightPalette, options);
2056
- const darkBase = buildTokenEntries(this.darkPalette, options);
2192
+ const lightBase = buildTokenEntries(lightPalette, options);
2193
+ const darkBase = buildTokenEntries(darkPalette, options);
2057
2194
  return {
2058
2195
  // Light block carries dark values under -inverted suffix.
2059
2196
  lightBlock: [
@@ -2067,6 +2204,22 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
2067
2204
  ]
2068
2205
  };
2069
2206
  }
2207
+ outputPalette(theme) {
2208
+ const palette = surfaceForegrounds(
2209
+ theme === "light" ? this.lightPalette : this.darkPalette,
2210
+ theme,
2211
+ this.resolvedOptions(),
2212
+ this.surfaceForegroundRoles()
2213
+ );
2214
+ for (const [coordinate, value] of this.foregroundOverrides) {
2215
+ const [role, variant] = coordinate.split(".");
2216
+ palette[role][variant] = convert(
2217
+ this.resolveTokenValue(value, theme, palette),
2218
+ "oklch"
2219
+ );
2220
+ }
2221
+ return palette;
2222
+ }
2070
2223
  applyRole(name, color) {
2071
2224
  const parsedColor = this.isDerivedToken(color) ? this.resolveDerivedToken(color, this.lightPalette, "light") : parse(color);
2072
2225
  const opts = this.resolvedOptions();
@@ -2191,6 +2344,11 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
2191
2344
  }
2192
2345
  }
2193
2346
  applyToken(name, value) {
2347
+ const [role, variant] = name.split(".");
2348
+ if (name === `${role}.${variant}` && isRoleForeground(this.surfaceForegroundRoles(), role, variant)) {
2349
+ this.foregroundOverrides.set(name, value);
2350
+ return;
2351
+ }
2194
2352
  if (name.includes(".")) {
2195
2353
  this.applyPalettePin(name, value);
2196
2354
  return;
@@ -2227,20 +2385,45 @@ var HextimatePaletteBuilder = class _HextimatePaletteBuilder {
2227
2385
  this.resolveTokenValue(value, "dark", this.darkPalette),
2228
2386
  "oklch"
2229
2387
  );
2388
+ this.pinnedCoordinates.add(coordinate);
2389
+ if (variant !== "DEFAULT" && variant !== "foreground") return;
2390
+ const repickForeground = variant === "DEFAULT" && !this.pinnedCoordinates.has(`${role}.foreground`);
2391
+ const recomputeWeak = !this.pinnedCoordinates.has(
2392
+ `${role}.foreground-weak`
2393
+ );
2394
+ const contrastTarget = resolveContrastRatio(this.options.minContrastRatio) + CONTRAST_MARGIN;
2395
+ for (const palette of [this.lightPalette, this.darkPalette]) {
2396
+ const scale = palette[role];
2397
+ if (scale.foreground === void 0) continue;
2398
+ const base = convert(parse(scale.DEFAULT), "oklch");
2399
+ let foreground = convert(parse(scale.foreground), "oklch");
2400
+ if (repickForeground && calculateContrast(foreground, base) < contrastTarget) {
2401
+ const [dark, light] = [0.1, 0.97].map((l) => ({ ...foreground, l }));
2402
+ foreground = calculateContrast(dark, base) >= calculateContrast(light, base) ? dark : light;
2403
+ scale.foreground = foreground;
2404
+ }
2405
+ if (recomputeWeak && scale["foreground-weak"] !== void 0) {
2406
+ scale["foreground-weak"] = computeSoftestForeground(
2407
+ foreground,
2408
+ base,
2409
+ contrastTarget
2410
+ );
2411
+ }
2412
+ }
2230
2413
  }
2231
2414
  /**
2232
2415
  * Standalone token names must not squash palette flat keys after
2233
2416
  * roleNames / variantNames / separator / excludes are applied.
2234
2417
  */
2235
- assertNoPaletteLabelCollisions(options) {
2418
+ assertNoPaletteLabelCollisions(options, palette) {
2236
2419
  if (this.standaloneTokens.length === 0) return;
2237
2420
  const sep = options?.separator ?? "-";
2238
2421
  const excludeRoles = new Set(options?.excludeRoles ?? []);
2239
2422
  const excludeVariants = new Set(options?.excludeVariants ?? []);
2240
2423
  const labelToCoord = /* @__PURE__ */ new Map();
2241
- for (const role of Object.keys(this.lightPalette)) {
2424
+ for (const role of Object.keys(palette)) {
2242
2425
  if (excludeRoles.has(role)) continue;
2243
- const scale = this.lightPalette[role];
2426
+ const scale = palette[role];
2244
2427
  for (const variant of Object.keys(scale)) {
2245
2428
  if (excludeVariants.has(variant)) continue;
2246
2429
  const raw = scale[variant];
@@ -2378,8 +2561,9 @@ Did you mean addToken("${suggestion}") to change the palette?`
2378
2561
  if (this.strongSideVariants.includes(variantName)) {
2379
2562
  return this.strongSideVariants;
2380
2563
  }
2564
+ const surface = this.surfaceForegroundRoles().surface;
2381
2565
  const sampleRole = Object.keys(this.lightPalette).find(
2382
- (r) => r !== "surface"
2566
+ (r) => r !== surface
2383
2567
  );
2384
2568
  if (!sampleRole) return null;
2385
2569
  const scale = this.lightPalette[sampleRole];
@@ -2544,10 +2728,10 @@ var HextimateError = class extends Error {
2544
2728
  this.name = "HextimateError";
2545
2729
  }
2546
2730
  };
2547
- function hextimate(color) {
2731
+ function hextimate(color, theme) {
2548
2732
  try {
2549
2733
  const parsedColor = parse(color);
2550
- return new HextimatePaletteBuilder(parsedColor);
2734
+ return new HextimatePaletteBuilder(parsedColor, theme);
2551
2735
  } catch (e) {
2552
2736
  if (e instanceof HextimateError) {
2553
2737
  throw e;
@@ -2566,6 +2750,42 @@ function fromConfig(c) {
2566
2750
  return b;
2567
2751
  }
2568
2752
 
2753
+ // src/tailwindAliases.ts
2754
+ function tailwindAliases(theme, { as: runtimeFormat, inverted = false, ...names } = {}) {
2755
+ const as = runtimeFormat ?? theme.format?.as ?? "object";
2756
+ if (as !== "object" && as !== "css") {
2757
+ throw new Error("Tailwind aliases require object or css runtime output.");
2758
+ }
2759
+ const { light, dark } = hextimate(
2760
+ theme.defaultAccent ?? "#737373",
2761
+ theme
2762
+ ).format({
2763
+ ...names,
2764
+ as: "object",
2765
+ ...as === "css" && { keyPrefix: "" },
2766
+ invertedVariants: false
2767
+ });
2768
+ const separator = { separator: theme.format?.separator, ...names }.separator ?? "-";
2769
+ const suffix = inverted ? `${separator}inverted` : "";
2770
+ const keys = /* @__PURE__ */ new Set([...Object.keys(light), ...Object.keys(dark)]);
2771
+ const aliases = Array.from(keys, (name) => {
2772
+ const key = `${as === "object" ? name.replace(/^--/, "") : name}${suffix}`;
2773
+ return ` --color-${key}: var(--${key});`;
2774
+ });
2775
+ return ["@theme inline {", ...aliases, "}", ""].join("\n");
2776
+ }
2777
+
2778
+ // src/themes.ts
2779
+ var themes_exports = {};
2780
+ __export(themes_exports, {
2781
+ bold: () => boldTheme,
2782
+ mui: () => muiTheme,
2783
+ muted: () => mutedTheme,
2784
+ shadcn: () => shadcnTheme,
2785
+ tinted: () => tintedTheme,
2786
+ vibrant: () => vibrantTheme
2787
+ });
2788
+
2569
2789
  export {
2570
2790
  convert,
2571
2791
  parse,
@@ -2574,5 +2794,7 @@ export {
2574
2794
  HextimatePaletteBuilder,
2575
2795
  HextimateError,
2576
2796
  hextimate,
2577
- fromConfig
2797
+ fromConfig,
2798
+ tailwindAliases,
2799
+ themes_exports
2578
2800
  };