@sanity/themer 0.0.0 → 0.2.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.
Files changed (41) hide show
  1. package/README.md +33 -58
  2. package/dist/index.d.ts +51 -23
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +2 -2
  5. package/dist/legacy.d.ts +7 -18
  6. package/dist/legacy.d.ts.map +1 -1
  7. package/dist/legacy.js +39 -39
  8. package/dist/legacy.js.map +1 -1
  9. package/dist/{_chunks/mix.js → mix-BfV6_Ke4.js} +1 -1
  10. package/dist/mix-BfV6_Ke4.js.map +1 -0
  11. package/dist/options-BaqJJgRs.d.ts +59 -0
  12. package/dist/options-BaqJJgRs.d.ts.map +1 -0
  13. package/dist/presets-DWzYcsLg.js +375 -0
  14. package/dist/presets-DWzYcsLg.js.map +1 -0
  15. package/dist/tool.d.ts +22 -15
  16. package/dist/tool.d.ts.map +1 -1
  17. package/dist/tool.js +608 -282
  18. package/dist/tool.js.map +1 -1
  19. package/package.json +24 -39
  20. package/dist/_chunks/mix.cjs +0 -52
  21. package/dist/_chunks/mix.cjs.map +0 -1
  22. package/dist/_chunks/mix.js.map +0 -1
  23. package/dist/_chunks/presets.cjs +0 -215
  24. package/dist/_chunks/presets.cjs.map +0 -1
  25. package/dist/_chunks/presets.js +0 -201
  26. package/dist/_chunks/presets.js.map +0 -1
  27. package/dist/_chunks/types.d.cts +0 -26
  28. package/dist/_chunks/types.d.cts.map +0 -1
  29. package/dist/_chunks/types.d.ts +0 -26
  30. package/dist/_chunks/types.d.ts.map +0 -1
  31. package/dist/index.cjs +0 -3
  32. package/dist/index.d.cts +0 -63
  33. package/dist/index.d.cts.map +0 -1
  34. package/dist/legacy.cjs +0 -1199
  35. package/dist/legacy.cjs.map +0 -1
  36. package/dist/legacy.d.cts +0 -166
  37. package/dist/legacy.d.cts.map +0 -1
  38. package/dist/tool.cjs +0 -407
  39. package/dist/tool.cjs.map +0 -1
  40. package/dist/tool.d.cts +0 -45
  41. package/dist/tool.d.cts.map +0 -1
@@ -1,201 +0,0 @@
1
- import { n as mix, t as isColor } from "./mix.js";
2
- import { COLOR_TINTS, color } from "@sanity/color";
3
- import { buildTheme } from "@sanity/ui/theme";
4
- /** The palette hue that each themeable color drives */
5
- const HUE_MAPPING = [
6
- ["gray", "gray"],
7
- ["primary", "blue"],
8
- ["positive", "green"],
9
- ["caution", "yellow"],
10
- ["critical", "red"]
11
- ];
12
- /**
13
- * Maps themeable colors to a `@sanity/ui` `ThemeConfig`, for when a theme
14
- * needs further customization than `createTheme` exposes:
15
- *
16
- * ```ts
17
- * import {themeConfigFromColors} from '@sanity/themer'
18
- * import {buildTheme} from '@sanity/ui/theme'
19
- *
20
- * const theme = buildTheme({
21
- * ...themeConfigFromColors({primary: '#2276fc'}),
22
- * // ...other ThemeConfig properties
23
- * })
24
- * ```
25
- *
26
- * @public
27
- */
28
- function themeConfigFromColors(colors) {
29
- for (let [key, value] of Object.entries(colors)) if (typeof value == "string" && !isColor(value)) throw TypeError(`Invalid color for ${JSON.stringify(key)}: ${JSON.stringify(value)} — expected a hex color`);
30
- let anchored = !!(colors.lightest || colors.darkest);
31
- if (!anchored && !HUE_MAPPING.some(([option]) => colors[option])) return {};
32
- let lightest = (colors.lightest ?? color.white.hex).toLowerCase(), darkest = (colors.darkest ?? color.black.hex).toLowerCase(), palette = {
33
- ...color,
34
- black: darkest,
35
- white: lightest
36
- };
37
- for (let [option, hueKey] of HUE_MAPPING) {
38
- let mid = colors[option]?.toLowerCase();
39
- (mid || anchored) && (palette[hueKey] = buildHueTints({
40
- mid: mid ?? color[hueKey][500].hex,
41
- lightest,
42
- darkest
43
- }));
44
- }
45
- return { palette };
46
- }
47
- /**
48
- * Generates a Sanity Studio theme from a handful of colors:
49
- *
50
- * ```ts
51
- * import {createTheme} from '@sanity/themer'
52
- * import {defineConfig} from 'sanity'
53
- *
54
- * export default defineConfig({
55
- * theme: createTheme({primary: '#2276fc'}),
56
- * // ...rest of the config
57
- * })
58
- * ```
59
- *
60
- * Calling it without options returns the default Sanity Studio theme.
61
- *
62
- * @public
63
- */
64
- function createTheme(colors = {}) {
65
- return buildTheme(themeConfigFromColors(colors));
66
- }
67
- /**
68
- * Interpolates a full tint ramp (50–950) from a mid color placed at the 500
69
- * tint, sliding towards `lightest` and `darkest` at the extremes.
70
- */
71
- function buildHueTints(options) {
72
- let { mid, lightest, darkest } = options;
73
- return COLOR_TINTS.reduce((tints, tintKey) => {
74
- let tint = Number(tintKey);
75
- return tint === 500 ? tints[tintKey] = mid : tint < 500 ? tints[tintKey] = mix(tint / 500, mid, lightest) : tints[tintKey] = mix((tint - 500) / 500, darkest, mid), tints;
76
- }, {});
77
- }
78
- /**
79
- * Preset themes, carried over from the hosted Themer service
80
- * (themer.sanity.build) and re-expressed as `createTheme` colors.
81
- *
82
- * ```ts
83
- * import {createTheme, presets} from '@sanity/themer'
84
- *
85
- * const verdant = presets.find((preset) => preset.slug === 'verdant')
86
- * const theme = createTheme(verdant.colors)
87
- * ```
88
- *
89
- * @public
90
- */
91
- const presets = [
92
- {
93
- slug: "default",
94
- title: "Studio",
95
- colors: {}
96
- },
97
- {
98
- slug: "dew",
99
- title: "Dew",
100
- colors: {
101
- gray: "#5e63b4",
102
- primary: "#d1a308",
103
- positive: "#43d675",
104
- caution: "#fb9f24",
105
- critical: "#f03e2f",
106
- lightest: "#fcfcfd",
107
- darkest: "#0d0d15"
108
- }
109
- },
110
- {
111
- slug: "pink-synth",
112
- title: "Pink Synth",
113
- colors: {
114
- gray: "#8b6584",
115
- primary: "#ec4899",
116
- positive: "#10b981",
117
- caution: "#fde047",
118
- critical: "#fe3459",
119
- lightest: "#f7f2f5",
120
- darkest: "#171721"
121
- }
122
- },
123
- {
124
- slug: "pixel-art",
125
- title: "Pixel Art",
126
- colors: {
127
- gray: "#57619c",
128
- primary: "#f10784",
129
- positive: "#43d675",
130
- caution: "#fbd024",
131
- lightest: "#fcfcfd",
132
- darkest: "#0d0e15"
133
- }
134
- },
135
- {
136
- slug: "retro-colonial",
137
- title: "Retro Colonial",
138
- colors: {
139
- gray: "#8bb9b5",
140
- primary: "#fa7a78",
141
- positive: "#43d675",
142
- caution: "#fbd024",
143
- critical: "#f02f53",
144
- lightest: "#fcfdfd",
145
- darkest: "#0d1515"
146
- }
147
- },
148
- {
149
- slug: "rosabel",
150
- title: "Rosabel",
151
- colors: {
152
- gray: "#9d8966",
153
- primary: "#ed2555",
154
- positive: "#43d675",
155
- caution: "#fbd024",
156
- lightest: "#fdfdfc",
157
- darkest: "#15120d"
158
- }
159
- },
160
- {
161
- slug: "stereofidelic",
162
- title: "Stereofidelic",
163
- colors: {
164
- gray: "#678e9a",
165
- primary: "#f13009",
166
- positive: "#43d675",
167
- caution: "#fbd024",
168
- critical: "#f02f35",
169
- lightest: "#fcfdfd",
170
- darkest: "#0e1315"
171
- }
172
- },
173
- {
174
- slug: "tw-cyan",
175
- title: "Tailwind Cyan",
176
- colors: {
177
- gray: "#677389",
178
- primary: "#51b4d0",
179
- positive: "#55b785",
180
- caution: "#e2b53e",
181
- critical: "#e14f62",
182
- lightest: "#f9fafb",
183
- darkest: "#101728"
184
- }
185
- },
186
- {
187
- slug: "verdant",
188
- title: "Verdant",
189
- colors: {
190
- gray: "#5c9199",
191
- primary: "#1cb485",
192
- positive: "#43d675",
193
- caution: "#fbd024",
194
- lightest: "#fcfdfd",
195
- darkest: "#0d1415"
196
- }
197
- }
198
- ];
199
- export { createTheme as n, themeConfigFromColors as r, presets as t };
200
-
201
- //# sourceMappingURL=presets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"presets.js","names":[],"sources":["../../src/createTheme.ts","../../src/presets.ts"],"sourcesContent":["import {color, COLOR_TINTS, ColorHueKey, ColorTintKey} from '@sanity/color'\nimport {buildTheme, RootTheme, ThemeColorPalette, ThemeConfig} from '@sanity/ui/theme'\n\nimport {isColor, mix} from './lib/mix'\nimport {CreateThemeOptions} from './types'\n\n/** The palette hue that each themeable color drives */\nconst HUE_MAPPING: ReadonlyArray<[option: keyof CreateThemeOptions, hueKey: ColorHueKey]> = [\n ['gray', 'gray'],\n ['primary', 'blue'],\n ['positive', 'green'],\n ['caution', 'yellow'],\n ['critical', 'red'],\n]\n\n/**\n * Maps themeable colors to a `@sanity/ui` `ThemeConfig`, for when a theme\n * needs further customization than `createTheme` exposes:\n *\n * ```ts\n * import {themeConfigFromColors} from '@sanity/themer'\n * import {buildTheme} from '@sanity/ui/theme'\n *\n * const theme = buildTheme({\n * ...themeConfigFromColors({primary: '#2276fc'}),\n * // ...other ThemeConfig properties\n * })\n * ```\n *\n * @public\n */\nexport function themeConfigFromColors(colors: CreateThemeOptions): ThemeConfig {\n for (const [key, value] of Object.entries(colors)) {\n if (typeof value === 'string' && !isColor(value)) {\n throw new TypeError(\n `Invalid color for ${JSON.stringify(key)}: ${JSON.stringify(value)} — expected a hex color`,\n )\n }\n }\n\n const anchored = Boolean(colors.lightest || colors.darkest)\n\n if (!anchored && !HUE_MAPPING.some(([option]) => colors[option])) {\n return {}\n }\n\n const lightest = (colors.lightest ?? color.white.hex).toLowerCase()\n const darkest = (colors.darkest ?? color.black.hex).toLowerCase()\n\n const palette: ThemeColorPalette = {...color, black: darkest, white: lightest}\n\n for (const [option, hueKey] of HUE_MAPPING) {\n const mid = colors[option]?.toLowerCase()\n\n // Untouched ramps only need regenerating when the surface endpoints moved\n if (mid || anchored) {\n palette[hueKey] = buildHueTints({\n mid: mid ?? color[hueKey][500].hex,\n lightest,\n darkest,\n })\n }\n }\n\n return {palette}\n}\n\n/**\n * Generates a Sanity Studio theme from a handful of colors:\n *\n * ```ts\n * import {createTheme} from '@sanity/themer'\n * import {defineConfig} from 'sanity'\n *\n * export default defineConfig({\n * theme: createTheme({primary: '#2276fc'}),\n * // ...rest of the config\n * })\n * ```\n *\n * Calling it without options returns the default Sanity Studio theme.\n *\n * @public\n */\nexport function createTheme(colors: CreateThemeOptions = {}): RootTheme {\n return buildTheme(themeConfigFromColors(colors))\n}\n\n/**\n * Interpolates a full tint ramp (50–950) from a mid color placed at the 500\n * tint, sliding towards `lightest` and `darkest` at the extremes.\n */\nfunction buildHueTints(options: {\n mid: string\n lightest: string\n darkest: string\n}): Record<ColorTintKey, string> {\n const {mid, lightest, darkest} = options\n\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- the reduce assigns every COLOR_TINTS key, so the Partial is complete\n return COLOR_TINTS.reduce<Partial<Record<ColorTintKey, string>>>((tints, tintKey) => {\n const tint = Number(tintKey)\n\n if (tint === 500) {\n tints[tintKey] = mid\n } else if (tint < 500) {\n tints[tintKey] = mix(tint / 500, mid, lightest)\n } else {\n tints[tintKey] = mix((tint - 500) / 500, darkest, mid)\n }\n\n return tints\n }, {}) as Record<ColorTintKey, string>\n}\n","import {CreateThemeOptions} from './types'\n\n/**\n * A named set of colors for `createTheme`.\n *\n * @public\n */\nexport interface ThemePreset {\n slug: string\n title: string\n colors: CreateThemeOptions\n}\n\n/**\n * Preset themes, carried over from the hosted Themer service\n * (themer.sanity.build) and re-expressed as `createTheme` colors.\n *\n * ```ts\n * import {createTheme, presets} from '@sanity/themer'\n *\n * const verdant = presets.find((preset) => preset.slug === 'verdant')\n * const theme = createTheme(verdant.colors)\n * ```\n *\n * @public\n */\nexport const presets: ThemePreset[] = [\n {\n slug: 'default',\n title: 'Studio',\n colors: {},\n },\n {\n slug: 'dew',\n title: 'Dew',\n colors: {\n gray: '#5e63b4',\n primary: '#d1a308',\n positive: '#43d675',\n caution: '#fb9f24',\n critical: '#f03e2f',\n lightest: '#fcfcfd',\n darkest: '#0d0d15',\n },\n },\n {\n slug: 'pink-synth',\n title: 'Pink Synth',\n colors: {\n gray: '#8b6584',\n primary: '#ec4899',\n positive: '#10b981',\n caution: '#fde047',\n critical: '#fe3459',\n lightest: '#f7f2f5',\n darkest: '#171721',\n },\n },\n {\n slug: 'pixel-art',\n title: 'Pixel Art',\n colors: {\n gray: '#57619c',\n primary: '#f10784',\n positive: '#43d675',\n caution: '#fbd024',\n lightest: '#fcfcfd',\n darkest: '#0d0e15',\n },\n },\n {\n slug: 'retro-colonial',\n title: 'Retro Colonial',\n colors: {\n gray: '#8bb9b5',\n primary: '#fa7a78',\n positive: '#43d675',\n caution: '#fbd024',\n critical: '#f02f53',\n lightest: '#fcfdfd',\n darkest: '#0d1515',\n },\n },\n {\n slug: 'rosabel',\n title: 'Rosabel',\n colors: {\n gray: '#9d8966',\n primary: '#ed2555',\n positive: '#43d675',\n caution: '#fbd024',\n lightest: '#fdfdfc',\n darkest: '#15120d',\n },\n },\n {\n slug: 'stereofidelic',\n title: 'Stereofidelic',\n colors: {\n gray: '#678e9a',\n primary: '#f13009',\n positive: '#43d675',\n caution: '#fbd024',\n critical: '#f02f35',\n lightest: '#fcfdfd',\n darkest: '#0e1315',\n },\n },\n {\n slug: 'tw-cyan',\n title: 'Tailwind Cyan',\n colors: {\n gray: '#677389',\n primary: '#51b4d0',\n positive: '#55b785',\n caution: '#e2b53e',\n critical: '#e14f62',\n lightest: '#f9fafb',\n darkest: '#101728',\n },\n },\n {\n slug: 'verdant',\n title: 'Verdant',\n colors: {\n gray: '#5c9199',\n primary: '#1cb485',\n positive: '#43d675',\n caution: '#fbd024',\n lightest: '#fcfdfd',\n darkest: '#0d1415',\n },\n },\n]\n"],"mappings":";;;;AAOA,MAAM,cAAsF;CAC1F,CAAC,QAAQ,MAAM;CACf,CAAC,WAAW,MAAM;CAClB,CAAC,YAAY,OAAO;CACpB,CAAC,WAAW,QAAQ;CACpB,CAAC,YAAY,KAAK;AACpB;;;;;;;;;;;;;;;;;AAkBA,SAAgB,sBAAsB,QAAyC;CAC7E,KAAK,IAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAC9C,IAAI,OAAO,SAAU,YAAY,CAAC,QAAQ,KAAK,GAC7C,MAAU,UACR,qBAAqB,KAAK,UAAU,GAAG,EAAE,IAAI,KAAK,UAAU,KAAK,EAAE,wBACrE;CAIJ,IAAM,WAAW,GAAQ,OAAO,YAAY,OAAO;CAEnD,IAAI,CAAC,YAAY,CAAC,YAAY,MAAM,CAAC,YAAY,OAAO,OAAO,GAC7D,OAAO,CAAC;CAGV,IAAM,YAAY,OAAO,YAAY,MAAM,MAAM,IAAA,CAAK,YAAY,GAC5D,WAAW,OAAO,WAAW,MAAM,MAAM,IAAA,CAAK,YAAY,GAE1D,UAA6B;EAAC,GAAG;EAAO,OAAO;EAAS,OAAO;CAAQ;CAE7E,KAAK,IAAM,CAAC,QAAQ,WAAW,aAAa;EAC1C,IAAM,MAAM,OAAO,OAAO,EAAE,YAAY;EAGxC,CAAI,OAAO,cACT,QAAQ,UAAU,cAAc;GAC9B,KAAK,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC;GAC/B;GACA;EACF,CAAC;CAEL;CAEA,OAAO,EAAC,QAAO;AACjB;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,YAAY,SAA6B,CAAC,GAAc;CACtE,OAAO,WAAW,sBAAsB,MAAM,CAAC;AACjD;;;;;AAMA,SAAS,cAAc,SAIU;CAC/B,IAAM,EAAC,KAAK,UAAU,YAAW;CAGjC,OAAO,YAAY,QAA+C,OAAO,YAAY;EACnF,IAAM,OAAO,OAAO,OAAO;EAU3B,OARI,SAAS,MACX,MAAM,WAAW,MACR,OAAO,MAChB,MAAM,WAAW,IAAI,OAAO,KAAK,KAAK,QAAQ,IAE9C,MAAM,WAAW,KAAK,OAAO,OAAO,KAAK,SAAS,GAAG,GAGhD;CACT,GAAG,CAAC,CAAC;AACP;;;;;;;;;;;;;;ACvFA,MAAa,UAAyB;CACpC;EACE,MAAM;EACN,OAAO;EACP,QAAQ,CAAC;CACX;CACA;EACE,MAAM;EACN,OAAO;EACP,QAAQ;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,SAAS;GACT,UAAU;GACV,UAAU;GACV,SAAS;EACX;CACF;CACA;EACE,MAAM;EACN,OAAO;EACP,QAAQ;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,SAAS;GACT,UAAU;GACV,UAAU;GACV,SAAS;EACX;CACF;CACA;EACE,MAAM;EACN,OAAO;EACP,QAAQ;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,SAAS;GACT,UAAU;GACV,SAAS;EACX;CACF;CACA;EACE,MAAM;EACN,OAAO;EACP,QAAQ;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,SAAS;GACT,UAAU;GACV,UAAU;GACV,SAAS;EACX;CACF;CACA;EACE,MAAM;EACN,OAAO;EACP,QAAQ;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,SAAS;GACT,UAAU;GACV,SAAS;EACX;CACF;CACA;EACE,MAAM;EACN,OAAO;EACP,QAAQ;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,SAAS;GACT,UAAU;GACV,UAAU;GACV,SAAS;EACX;CACF;CACA;EACE,MAAM;EACN,OAAO;EACP,QAAQ;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,SAAS;GACT,UAAU;GACV,UAAU;GACV,SAAS;EACX;CACF;CACA;EACE,MAAM;EACN,OAAO;EACP,QAAQ;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,SAAS;GACT,UAAU;GACV,SAAS;EACX;CACF;AACF"}
@@ -1,26 +0,0 @@
1
- /**
2
- * The colors that `createTheme` derives a Sanity Studio theme from.
3
- *
4
- * Every color is optional — omitted colors keep their default Sanity ramps.
5
- * All values are hex colors (`#rgb` or `#rrggbb`).
6
- *
7
- * @public
8
- */
9
- interface CreateThemeOptions {
10
- /** Tints the neutral colors (surfaces, borders and text). */
11
- gray?: string;
12
- /** The brand color — used for buttons, focus rings, links and selections. */
13
- primary?: string;
14
- /** The color of positive accents, like success badges. */
15
- positive?: string;
16
- /** The color of caution accents, like warning badges. */
17
- caution?: string;
18
- /** The color of critical accents, like errors and destructive actions. */
19
- critical?: string;
20
- /** The lightest surface color — the background of the light color scheme. */
21
- lightest?: string;
22
- /** The darkest surface color — the background of the dark color scheme. */
23
- darkest?: string;
24
- }
25
- export { CreateThemeOptions as t };
26
- //# sourceMappingURL=types.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/types.ts"],"mappings":"AAQA;;;;;;;;UAAiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA"}
@@ -1,26 +0,0 @@
1
- /**
2
- * The colors that `createTheme` derives a Sanity Studio theme from.
3
- *
4
- * Every color is optional — omitted colors keep their default Sanity ramps.
5
- * All values are hex colors (`#rgb` or `#rrggbb`).
6
- *
7
- * @public
8
- */
9
- interface CreateThemeOptions {
10
- /** Tints the neutral colors (surfaces, borders and text). */
11
- gray?: string;
12
- /** The brand color — used for buttons, focus rings, links and selections. */
13
- primary?: string;
14
- /** The color of positive accents, like success badges. */
15
- positive?: string;
16
- /** The color of caution accents, like warning badges. */
17
- caution?: string;
18
- /** The color of critical accents, like errors and destructive actions. */
19
- critical?: string;
20
- /** The lightest surface color — the background of the light color scheme. */
21
- lightest?: string;
22
- /** The darkest surface color — the background of the dark color scheme. */
23
- darkest?: string;
24
- }
25
- export { CreateThemeOptions as t };
26
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":"AAQA;;;;;;;;UAAiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA"}
package/dist/index.cjs DELETED
@@ -1,3 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_presets = require("./_chunks/presets.cjs");
3
- exports.createTheme = require_presets.n, exports.presets = require_presets.t, exports.themeConfigFromColors = require_presets.r;
package/dist/index.d.cts DELETED
@@ -1,63 +0,0 @@
1
- import { t as CreateThemeOptions } from "./_chunks/types.cjs";
2
- import { RootTheme, ThemeConfig } from "@sanity/ui/theme";
3
- /**
4
- * Maps themeable colors to a `@sanity/ui` `ThemeConfig`, for when a theme
5
- * needs further customization than `createTheme` exposes:
6
- *
7
- * ```ts
8
- * import {themeConfigFromColors} from '@sanity/themer'
9
- * import {buildTheme} from '@sanity/ui/theme'
10
- *
11
- * const theme = buildTheme({
12
- * ...themeConfigFromColors({primary: '#2276fc'}),
13
- * // ...other ThemeConfig properties
14
- * })
15
- * ```
16
- *
17
- * @public
18
- */
19
- declare function themeConfigFromColors(colors: CreateThemeOptions): ThemeConfig;
20
- /**
21
- * Generates a Sanity Studio theme from a handful of colors:
22
- *
23
- * ```ts
24
- * import {createTheme} from '@sanity/themer'
25
- * import {defineConfig} from 'sanity'
26
- *
27
- * export default defineConfig({
28
- * theme: createTheme({primary: '#2276fc'}),
29
- * // ...rest of the config
30
- * })
31
- * ```
32
- *
33
- * Calling it without options returns the default Sanity Studio theme.
34
- *
35
- * @public
36
- */
37
- declare function createTheme(colors?: CreateThemeOptions): RootTheme;
38
- /**
39
- * A named set of colors for `createTheme`.
40
- *
41
- * @public
42
- */
43
- interface ThemePreset {
44
- slug: string;
45
- title: string;
46
- colors: CreateThemeOptions;
47
- }
48
- /**
49
- * Preset themes, carried over from the hosted Themer service
50
- * (themer.sanity.build) and re-expressed as `createTheme` colors.
51
- *
52
- * ```ts
53
- * import {createTheme, presets} from '@sanity/themer'
54
- *
55
- * const verdant = presets.find((preset) => preset.slug === 'verdant')
56
- * const theme = createTheme(verdant.colors)
57
- * ```
58
- *
59
- * @public
60
- */
61
- declare const presets: ThemePreset[];
62
- export { CreateThemeOptions, ThemePreset, createTheme, presets, themeConfigFromColors };
63
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/createTheme.ts","../src/presets.ts"],"mappings":";;;;;;;;;;;;;;;;;;iBA+BgB,sBAAsB,QAAQ,qBAAqB;;;;;;;;;;;;;;;;;;iBAqDnD,YAAY,SAAQ,qBAA0B;;;;;;UC7E7C;EACf;EACA;EACA,QAAQ;;;;;;;;;;;;;;;cAgBG,SAAS"}