@sanity/themer 0.3.16 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/themer",
3
- "version": "0.3.16",
3
+ "version": "0.4.0",
4
4
  "description": "Generate Sanity Studio themes, and preview them with a Studio tool.",
5
5
  "keywords": [
6
6
  "sanity",
@@ -37,9 +37,11 @@
37
37
  "@sanity/icons": "^5.2.2",
38
38
  "@sanity/themer-legacy": "^0.1.0",
39
39
  "@sanity/ui": "^4.2.4",
40
+ "@xstate/react": "^6.1.0",
40
41
  "react-compiler-runtime": "1.0.0",
41
42
  "react-refractor": "^4.0.0",
42
- "refractor": "^5.0.0"
43
+ "refractor": "^5.0.0",
44
+ "xstate": "^5.33.2"
43
45
  },
44
46
  "devDependencies": {
45
47
  "@sanity/tsdown-config": "^0.28.1",
@@ -1,59 +0,0 @@
1
- /**
2
- * Options for {@link buildTheme} and {@link buildPalette}.
3
- *
4
- * Every color is a hex color (`#rgb` or `#rrggbb`). Passing the stock values
5
- * for every option — or just `accent: '#556bfc'` on its own — reproduces the
6
- * `@sanity/color` palette exactly, so the generated theme matches
7
- * `buildTheme()` from `@sanity/ui/theme` with no options.
8
- *
9
- * @public
10
- */
11
- interface BuildThemeOptions {
12
- /**
13
- * The accent color — the brand color of the theme. Replaces the `blue`
14
- * scale of the palette, which Sanity UI uses for primary buttons, focus
15
- * rings and links.
16
- *
17
- * The stock accent is `#556bfc` (`blue/500` of `@sanity/color`).
18
- */
19
- accent: string;
20
- /**
21
- * The backgrounds of the two color schemes. `dark` replaces `black` in the
22
- * palette and `light` replaces `white` — every other color of a scheme is
23
- * blended onto them.
24
- *
25
- * Both are kept far enough from the text and accent colors to stay usable:
26
- * `dark` is made darker until it has enough contrast with them (it can
27
- * never be lighter than either), and `light` can never be darker than
28
- * either.
29
- *
30
- * The stock backgrounds are `#0d0e12` (dark) and `#ffffff` (light).
31
- */
32
- background?: {
33
- /** The dark scheme background — defaults to `#0d0e12` */
34
- dark?: string;
35
- /** The light scheme background — defaults to `#ffffff` */
36
- light?: string;
37
- };
38
- /**
39
- * How strongly text and borders separate from the accent color, between 15
40
- * and 100. The default is 85, which uses the text color as-is. Above 85 the
41
- * text scale loses its tint until it is fully neutral at 100 — a high
42
- * contrast scheme with no mixing of the text and accent colors. Below 85
43
- * more and more of the accent color mixes into the text scale, giving text
44
- * and borders more color, until the scale fully adopts the accent hue and
45
- * saturation at 15.
46
- */
47
- contrast?: number;
48
- /**
49
- * The text color. Replaces the `gray` scale of the palette, which Sanity UI
50
- * uses for text, icons, borders and neutral surfaces. When omitted, it is
51
- * derived from the accent color: a mostly desaturated version of it, the
52
- * way the stock `gray` scale carries a hint of the stock blue.
53
- *
54
- * The stock text color is `#727892` (`gray/500` of `@sanity/color`).
55
- */
56
- text?: string;
57
- }
58
- export { BuildThemeOptions as t };
59
- //# sourceMappingURL=options-BaqJJgRs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"options-BaqJJgRs.d.ts","names":[],"sources":["../src/theme/options.ts"],"mappings":"AAeA;;;;;;;;;;UAAiB;;;;;;;;EAQf;;;;;;;;;;;;;EAcA;;IAEE;;IAEA;;;;;;;;;;;EAYF;;;;;;;;;EAUA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"presets-By3s-D-S.js","names":[],"sources":["../src/theme/hsl.ts","../src/lib/mix.ts","../src/theme/options.ts","../src/theme/buildPalette.ts","../src/theme/buildTheme.ts","../src/theme/presets.ts"],"sourcesContent":["/**\n * Color math for the palette generator, kept at full float precision: unlike\n * the HSL helpers in `@sanity/ui/theme`, nothing is rounded between the two\n * conversions, so `hslToHex(hexToHsl(hex))` returns `hex` unchanged for every\n * color. `buildTheme` relies on that to reproduce the stock `@sanity/color`\n * palette byte-for-byte when it is called with the stock anchor colors.\n */\n\n/**\n * A color in HSL space: `h` in degrees within `[0, 360)`, `s` and `l` as\n * fractions within `[0, 1]`.\n *\n * @internal\n */\nexport interface Hsl {\n h: number\n s: number\n l: number\n}\n\n/** @internal */\nexport function hexToHsl(hex: string): Hsl {\n const [r, g, b] = parseHex(hex)\n\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n const delta = max - min\n\n const l = (max + min) / 2\n\n if (delta === 0) {\n return {h: 0, s: 0, l}\n }\n\n const s = delta / (1 - Math.abs(2 * l - 1))\n\n let h: number\n\n if (max === r) {\n h = ((g - b) / delta) % 6\n } else if (max === g) {\n h = (b - r) / delta + 2\n } else {\n h = (r - g) / delta + 4\n }\n\n return {h: normalizeHue(h * 60), s, l}\n}\n\n/** @internal */\nexport function hslToHex(hsl: Hsl): string {\n const h = normalizeHue(hsl.h)\n const s = clamp01(hsl.s)\n const l = clamp01(hsl.l)\n\n const c = (1 - Math.abs(2 * l - 1)) * s\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1))\n const m = l - c / 2\n\n let r = 0\n let g = 0\n let b = 0\n\n if (h < 60) {\n r = c\n g = x\n } else if (h < 120) {\n r = x\n g = c\n } else if (h < 180) {\n g = c\n b = x\n } else if (h < 240) {\n g = x\n b = c\n } else if (h < 300) {\n r = x\n b = c\n } else {\n r = c\n b = x\n }\n\n return `#${channelToHex(r + m)}${channelToHex(g + m)}${channelToHex(b + m)}`\n}\n\n/**\n * Rotates `from` towards `to` along the shortest arc of the hue circle.\n *\n * @internal\n */\nexport function mixHue(from: number, to: number, amount: number): number {\n const delta = ((((to - from) % 360) + 540) % 360) - 180\n\n return normalizeHue(from + delta * amount)\n}\n\n/**\n * The WCAG relative luminance of a hex color, between 0 (black) and 1 (white).\n *\n * @internal\n */\nexport function relativeLuminance(hex: string): number {\n const [r, g, b] = parseHex(hex)\n\n return 0.2126 * linearChannel(r) + 0.7152 * linearChannel(g) + 0.0722 * linearChannel(b)\n}\n\nfunction linearChannel(value: number): number {\n return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4\n}\n\n/** Parses `#abc` and `#aabbcc` hex colors into channel fractions of 1 */\nfunction parseHex(hex: string): [number, number, number] {\n const expanded =\n hex.length === 4 ? `${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}` : hex.slice(1)\n\n return [\n parseInt(expanded.slice(0, 2), 16) / 255,\n parseInt(expanded.slice(2, 4), 16) / 255,\n parseInt(expanded.slice(4, 6), 16) / 255,\n ]\n}\n\nfunction channelToHex(value: number): string {\n return Math.round(clamp01(value) * 255)\n .toString(16)\n .padStart(2, '0')\n}\n\nfunction normalizeHue(hue: number): number {\n return ((hue % 360) + 360) % 360\n}\n\nfunction clamp01(value: number): number {\n return Math.min(1, Math.max(0, value))\n}\n","/**\n * Matches `#abc` and `#aabbcc` hex colors (the only formats the theme\n * generators accept), same as the hosted Themer service did.\n *\n * The `mix` function this module was named for moved to `@sanity/themer-legacy`\n * along with the legacy generator; `isColor` stays here for `theme/options.ts`\n * and `tool/storage.ts`.\n *\n * @internal\n */\nexport function isColor(input: string): boolean {\n return /^#(?:[0-9a-f]{3}){1,2}$/i.test(input)\n}\n","import {black, blue, gray, white} from '@sanity/color'\n\nimport {isColor} from '../lib/mix'\nimport {hexToHsl, hslToHex} from './hsl'\n\n/**\n * Options for {@link buildTheme} and {@link buildPalette}.\n *\n * Every color is a hex color (`#rgb` or `#rrggbb`). Passing the stock values\n * for every option — or just `accent: '#556bfc'` on its own — reproduces the\n * `@sanity/color` palette exactly, so the generated theme matches\n * `buildTheme()` from `@sanity/ui/theme` with no options.\n *\n * @public\n */\nexport interface BuildThemeOptions {\n /**\n * The accent color — the brand color of the theme. Replaces the `blue`\n * scale of the palette, which Sanity UI uses for primary buttons, focus\n * rings and links.\n *\n * The stock accent is `#556bfc` (`blue/500` of `@sanity/color`).\n */\n accent: string\n\n /**\n * The backgrounds of the two color schemes. `dark` replaces `black` in the\n * palette and `light` replaces `white` — every other color of a scheme is\n * blended onto them.\n *\n * Both are kept far enough from the text and accent colors to stay usable:\n * `dark` is made darker until it has enough contrast with them (it can\n * never be lighter than either), and `light` can never be darker than\n * either.\n *\n * The stock backgrounds are `#0d0e12` (dark) and `#ffffff` (light).\n */\n background?: {\n /** The dark scheme background — defaults to `#0d0e12` */\n dark?: string\n /** The light scheme background — defaults to `#ffffff` */\n light?: string\n }\n\n /**\n * How strongly text and borders separate from the accent color, between 15\n * and 100. The default is 85, which uses the text color as-is. Above 85 the\n * text scale loses its tint until it is fully neutral at 100 — a high\n * contrast scheme with no mixing of the text and accent colors. Below 85\n * more and more of the accent color mixes into the text scale, giving text\n * and borders more color, until the scale fully adopts the accent hue and\n * saturation at 15.\n */\n contrast?: number\n\n /**\n * The text color. Replaces the `gray` scale of the palette, which Sanity UI\n * uses for text, icons, borders and neutral surfaces. When omitted, it is\n * derived from the accent color: a mostly desaturated version of it, the\n * way the stock `gray` scale carries a hint of the stock blue.\n *\n * The stock text color is `#727892` (`gray/500` of `@sanity/color`).\n */\n text?: string\n}\n\n/**\n * {@link BuildThemeOptions} with every option filled in: colors normalized to\n * lowercase `#rrggbb`, the text color derived from the accent when it was\n * omitted, and the contrast clamped into its valid range.\n *\n * @internal\n */\nexport interface ResolvedThemeOptions {\n accent: string\n background: {dark: string; light: string}\n contrast: number\n text: string\n}\n\n/** The stock accent color — `blue/500` of `@sanity/color` @internal */\nexport const DEFAULT_ACCENT: string = blue[500].hex\n\n/** The stock text color — `gray/500` of `@sanity/color` @internal */\nexport const DEFAULT_TEXT: string = gray[500].hex\n\n/** The stock dark scheme background — `black` of `@sanity/color` @internal */\nexport const DEFAULT_BACKGROUND_DARK: string = black.hex\n\n/** The stock light scheme background — `white` of `@sanity/color` @internal */\nexport const DEFAULT_BACKGROUND_LIGHT: string = white.hex\n\n/** The contrast that applies the text color as-is @internal */\nexport const DEFAULT_CONTRAST = 85\n\n/** @internal */\nexport const MINIMUM_CONTRAST = 15\n\n/** @internal */\nexport const MAXIMUM_CONTRAST = 100\n\n/** @internal */\nexport function resolveThemeOptions(options: BuildThemeOptions): ResolvedThemeOptions {\n const accent = normalizeColor(options.accent, 'accent')\n\n return {\n accent,\n background: {\n dark:\n options.background?.dark === undefined\n ? DEFAULT_BACKGROUND_DARK\n : normalizeColor(options.background.dark, 'background.dark'),\n light:\n options.background?.light === undefined\n ? DEFAULT_BACKGROUND_LIGHT\n : normalizeColor(options.background.light, 'background.light'),\n },\n contrast: normalizeContrast(options.contrast),\n text:\n options.text === undefined ? deriveTextColor(accent) : normalizeColor(options.text, 'text'),\n }\n}\n\n/**\n * Derives the text color from an accent color, keeping the relationship the\n * stock palette has between `gray/500` and `blue/500`: the text color takes\n * the accent's hue (offset the way the stock gray is offset from the stock\n * blue), carries about an eighth of its saturation, and keeps the stock text\n * lightness. Deriving from the stock accent returns the stock text color.\n *\n * @internal\n */\nexport function deriveTextColor(accent: string): string {\n const accentHsl = hexToHsl(normalizeColor(accent, 'accent'))\n const defaultAccent = hexToHsl(DEFAULT_ACCENT)\n const defaultText = hexToHsl(DEFAULT_TEXT)\n\n return hslToHex({\n h: defaultText.h + (accentHsl.h - defaultAccent.h),\n s: Math.min(1, defaultText.s * (accentHsl.s / defaultAccent.s)),\n l: defaultText.l,\n })\n}\n\nfunction normalizeColor(value: string, name: string): string {\n if (typeof value !== 'string' || !isColor(value)) {\n throw new TypeError(\n `Invalid \\`${name}\\` color: ${JSON.stringify(value)} — expected a hex color like #556bfc`,\n )\n }\n\n const lower = value.toLowerCase()\n\n return lower.length === 4\n ? `#${lower[1]}${lower[1]}${lower[2]}${lower[2]}${lower[3]}${lower[3]}`\n : lower\n}\n\nfunction normalizeContrast(value: number | undefined): number {\n if (value === undefined) {\n return DEFAULT_CONTRAST\n }\n\n if (typeof value !== 'number' || !Number.isFinite(value)) {\n throw new TypeError(\n `Invalid \\`contrast\\`: ${JSON.stringify(value)} — expected a number between ${MINIMUM_CONTRAST} and ${MAXIMUM_CONTRAST}`,\n )\n }\n\n return Math.min(MAXIMUM_CONTRAST, Math.max(MINIMUM_CONTRAST, value))\n}\n","import {color, COLOR_TINTS, ColorHueKey, ColorTintKey, ColorTints} from '@sanity/color'\n\nimport {hexToHsl, Hsl, hslToHex, mixHue, relativeLuminance} from './hsl'\nimport {\n BuildThemeOptions,\n DEFAULT_ACCENT,\n DEFAULT_CONTRAST,\n DEFAULT_TEXT,\n MAXIMUM_CONTRAST,\n MINIMUM_CONTRAST,\n resolveThemeOptions,\n} from './options'\n\n/**\n * The lightness band the accent and text colors are clamped into — anchors\n * outside it would squeeze most of their scale's tints into an\n * indistinguishable sliver, messing with the rest of the scale.\n */\nconst MINIMUM_ANCHOR_LIGHTNESS = 0.25\nconst MAXIMUM_ANCHOR_LIGHTNESS = 0.75\n\n/**\n * The contrast ratio the dark background must reach against the 400 tints of\n * the text and accent scales — the tints Sanity UI paints muted text and\n * solid buttons with on dark backgrounds. The stock palette sits at ~6.8.\n */\nconst MINIMUM_DARK_BACKGROUND_CONTRAST = 4.5\n\n/** How much lightness each step of a background adjustment removes or adds */\nconst BACKGROUND_LIGHTNESS_STEP = 0.005\n\n/**\n * The color palette generated by {@link buildPalette}: the `palette` config\n * of `buildTheme` from `@sanity/ui/theme`, with every color as a hex string.\n *\n * @public\n */\nexport type GeneratedColorPalette = {black: string; white: string} & Record<\n ColorHueKey,\n Record<ColorTintKey, string>\n>\n\n/**\n * Generates a Sanity UI color palette from the theme options: the accent\n * color replaces the `blue` scale, the text color the `gray` scale, and the\n * backgrounds replace `black` and `white`. All other hues keep their stock\n * `@sanity/color` values. Called with the stock colors, it returns the stock\n * palette byte-for-byte.\n *\n * ```ts\n * import {buildPalette} from '@sanity/themer'\n *\n * const palette = buildPalette({accent: '#556bfc'})\n * ```\n *\n * @public\n */\nexport function buildPalette(options: BuildThemeOptions): GeneratedColorPalette {\n const resolved = resolveThemeOptions(options)\n\n const accentAnchor = clampAnchorLightness(hexToHsl(resolved.accent))\n const textAnchor = clampAnchorLightness(hexToHsl(resolved.text))\n const grayAnchor = applyContrast(textAnchor, accentAnchor, resolved.contrast)\n\n const blueTints = remapTints(color.blue, hexToHsl(DEFAULT_ACCENT), accentAnchor)\n const grayTints = remapTints(color.gray, hexToHsl(DEFAULT_TEXT), grayAnchor)\n\n const anchorLuminances = [\n relativeLuminance(hslToHex(grayAnchor)),\n relativeLuminance(hslToHex(accentAnchor)),\n ]\n\n return {\n black: darkenBackground(resolved.background.dark, {\n anchorLuminances,\n tints: [grayTints['400'], blueTints['400']],\n }),\n white: lightenBackground(resolved.background.light, anchorLuminances),\n gray: grayTints,\n blue: blueTints,\n purple: tintHexes(color.purple),\n magenta: tintHexes(color.magenta),\n red: tintHexes(color.red),\n orange: tintHexes(color.orange),\n yellow: tintHexes(color.yellow),\n green: tintHexes(color.green),\n cyan: tintHexes(color.cyan),\n }\n}\n\n/**\n * Mixes the accent color into the text color according to the contrast: 85\n * applies the text color as-is, 100 removes its tint entirely, and lower\n * values rotate and saturate it towards the accent.\n */\nfunction applyContrast(text: Hsl, accent: Hsl, contrast: number): Hsl {\n if (contrast === DEFAULT_CONTRAST) {\n return text\n }\n\n if (contrast > DEFAULT_CONTRAST) {\n const amount = (contrast - DEFAULT_CONTRAST) / (MAXIMUM_CONTRAST - DEFAULT_CONTRAST)\n\n return {h: text.h, s: text.s * (1 - amount), l: text.l}\n }\n\n const amount = (DEFAULT_CONTRAST - contrast) / (DEFAULT_CONTRAST - MINIMUM_CONTRAST)\n\n return {\n h: mixHue(text.h, accent.h, amount),\n s: text.s + (accent.s - text.s) * amount,\n l: text.l,\n }\n}\n\n/**\n * Rebuilds a stock tint scale around a new anchor color, where `from` is the\n * scale's stock 500 tint: hues rotate along, saturation scales\n * proportionally, and lightness is remapped piecewise so the anchor takes the\n * new lightness while the scale keeps spanning light to dark. When the anchor\n * matches the stock one, every tint comes back unchanged.\n */\nfunction remapTints(tints: ColorTints, from: Hsl, to: Hsl): Record<ColorTintKey, string> {\n const rotation = to.h - from.h\n const result: Partial<Record<ColorTintKey, string>> = {}\n\n for (const tint of COLOR_TINTS) {\n const value = hexToHsl(tints[tint].hex)\n\n result[tint] = hslToHex({\n h: value.h + rotation,\n s: remapSaturation(value.s, from.s, to.s),\n l: remapLightness(value.l, from.l, to.l),\n })\n }\n\n // oxlint-disable-next-line no-unsafe-type-assertion -- the loop assigns every tint key\n return result as Record<ColorTintKey, string>\n}\n\nfunction remapSaturation(value: number, from: number, to: number): number {\n if (from === to) {\n return value\n }\n\n return Math.min(1, value * (to / from))\n}\n\nfunction remapLightness(value: number, from: number, to: number): number {\n if (from === to) {\n return value\n }\n\n if (value <= from) {\n return value * (to / from)\n }\n\n return to + ((value - from) * (1 - to)) / (1 - from)\n}\n\nfunction clampAnchorLightness(anchor: Hsl): Hsl {\n const l = Math.min(MAXIMUM_ANCHOR_LIGHTNESS, Math.max(MINIMUM_ANCHOR_LIGHTNESS, anchor.l))\n\n return l === anchor.l ? anchor : {...anchor, l}\n}\n\n/**\n * Enforces the dark background rules: it can never be lighter than the text\n * or accent colors, and it must reach enough contrast with the 400 tints of\n * their scales — it is made darker until it does (or bottoms out at black).\n */\nfunction darkenBackground(\n hex: string,\n rules: {anchorLuminances: number[]; tints: string[]},\n): string {\n const maximumLuminance = Math.min(...rules.anchorLuminances)\n const tintLuminances = rules.tints.map((tint) => relativeLuminance(tint))\n\n const isDarkEnough = (background: string): boolean => {\n const luminance = relativeLuminance(background)\n\n return (\n luminance < maximumLuminance &&\n tintLuminances.every(\n (tintLuminance) =>\n (tintLuminance + 0.05) / (luminance + 0.05) >= MINIMUM_DARK_BACKGROUND_CONTRAST,\n )\n )\n }\n\n const {h, s, l} = hexToHsl(hex)\n let lightness = l\n let current = hex\n\n while (!isDarkEnough(current) && lightness > 0) {\n lightness = Math.max(0, lightness - BACKGROUND_LIGHTNESS_STEP)\n current = hslToHex({h, s, l: lightness})\n }\n\n return current\n}\n\n/**\n * Enforces the light background rule: it can never be darker than the text\n * or accent colors — it is made lighter until it is (or tops out at white).\n */\nfunction lightenBackground(hex: string, anchorLuminances: number[]): string {\n const minimumLuminance = Math.max(...anchorLuminances)\n\n const {h, s, l} = hexToHsl(hex)\n let lightness = l\n let current = hex\n\n while (relativeLuminance(current) <= minimumLuminance && lightness < 1) {\n lightness = Math.min(1, lightness + BACKGROUND_LIGHTNESS_STEP)\n current = hslToHex({h, s, l: lightness})\n }\n\n return current\n}\n\nfunction tintHexes(tints: ColorTints): Record<ColorTintKey, string> {\n const result: Partial<Record<ColorTintKey, string>> = {}\n\n for (const tint of COLOR_TINTS) {\n result[tint] = tints[tint].hex\n }\n\n // oxlint-disable-next-line no-unsafe-type-assertion -- the loop assigns every tint key\n return result as Record<ColorTintKey, string>\n}\n","import {buildTheme as buildUITheme, RootTheme} from '@sanity/ui/theme'\n\nimport {buildPalette} from './buildPalette'\nimport {BuildThemeOptions} from './options'\n\n/**\n * Generates a Studio theme from a handful of colors, by replacing the color\n * palette that the `buildTheme` from `@sanity/ui/theme` otherwise fills with\n * `@sanity/color`: the accent color replaces the `blue` scale (primary\n * buttons, focus rings, links), the optional text color the `gray` scale\n * (text, icons, borders), and the optional backgrounds replace `black` and\n * `white`. The result is the same type of theme that `@sanity/ui/theme`\n * builds, ready for the `theme` property of a Studio config.\n *\n * ```ts\n * import {buildTheme} from '@sanity/themer'\n * import {defineConfig} from 'sanity'\n *\n * export const theme = buildTheme({\n * accent: '#556bfc',\n * text: '#727892', // optional — derived from `accent` when omitted\n * background: {dark: '#0d0e12', light: '#ffffff'}, // optional\n * contrast: 85, // optional, 15–100\n * })\n *\n * export default defineConfig({\n * theme,\n * // ...rest of the config\n * })\n * ```\n *\n * Called with the stock colors — like the example — it returns the exact\n * same colors as `buildTheme()` from `@sanity/ui/theme` with no options.\n *\n * @public\n */\nexport function buildTheme(options: BuildThemeOptions): RootTheme {\n return buildUITheme({palette: buildPalette(options)})\n}\n","import {BuildThemeOptions, DEFAULT_ACCENT} from './options'\n\n/**\n * A preset theme: a named set of {@link BuildThemeOptions} ready to pass to\n * `buildTheme`.\n *\n * @public\n */\nexport interface ThemePreset {\n slug: string\n title: string\n /** The preset's theme options, ready to pass to `buildTheme` */\n options: BuildThemeOptions\n}\n\n/**\n * Preset themes for `buildTheme`, carried over from the hosted Themer service\n * (themer.sanity.build) presets: each one maps the legacy preset's primary\n * hue to `accent`, its default hue to `text` and its lightest/darkest colors\n * to the backgrounds.\n *\n * ```ts\n * import {buildTheme, presets} from '@sanity/themer'\n *\n * const verdant = presets.find((preset) => preset.slug === 'verdant')\n * const theme = buildTheme(verdant.options)\n * ```\n *\n * @public\n */\nexport const presets: ThemePreset[] = [\n {\n slug: 'studio',\n title: 'Studio',\n options: {accent: DEFAULT_ACCENT},\n },\n {\n slug: 'dew',\n title: 'Dew',\n options: {\n accent: '#d1a308',\n text: '#5e63b4',\n background: {dark: '#0d0d15', light: '#fcfcfd'},\n },\n },\n {\n slug: 'pink-synth',\n title: 'Pink Synth',\n options: {\n accent: '#ec4899',\n text: '#8b6584',\n background: {dark: '#171721', light: '#f7f2f5'},\n },\n },\n {\n slug: 'pixel-art',\n title: 'Pixel Art',\n options: {\n accent: '#f10784',\n text: '#57619c',\n background: {dark: '#0d0e15', light: '#fcfcfd'},\n },\n },\n {\n slug: 'retro-colonial',\n title: 'Retro Colonial',\n options: {\n accent: '#fa7a78',\n text: '#8bb9b5',\n background: {dark: '#0d1515', light: '#fcfdfd'},\n },\n },\n {\n slug: 'rosabel',\n title: 'Rosabel',\n options: {\n accent: '#ed2555',\n text: '#9d8966',\n background: {dark: '#15120d', light: '#fdfdfc'},\n },\n },\n {\n slug: 'stereofidelic',\n title: 'Stereofidelic',\n options: {\n accent: '#f13009',\n text: '#678e9a',\n background: {dark: '#0e1315', light: '#fcfdfd'},\n },\n },\n {\n slug: 'verdant',\n title: 'Verdant',\n options: {\n accent: '#1cb485',\n text: '#5c9199',\n background: {dark: '#0d1415', light: '#fcfdfd'},\n },\n },\n]\n"],"mappings":";;;AAqBA,SAAgB,SAAS,KAAkB;CACzC,IAAM,CAAC,GAAG,GAAG,KAAK,SAAS,GAAG,GAExB,MAAM,K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