@orz/themes 0.0.0-stage → 0.0.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 (87) hide show
  1. package/LICENSE +29 -0
  2. package/README.md +128 -2
  3. package/dist/amoled.d.ts +16 -0
  4. package/dist/amoled.d.ts.map +1 -0
  5. package/dist/amoled.js +95 -0
  6. package/dist/amoled.js.map +1 -0
  7. package/dist/builtin.d.ts +4 -0
  8. package/dist/builtin.d.ts.map +1 -0
  9. package/dist/builtin.js +28 -0
  10. package/dist/builtin.js.map +1 -0
  11. package/dist/compose.d.ts +14 -0
  12. package/dist/compose.d.ts.map +1 -0
  13. package/dist/compose.js +75 -0
  14. package/dist/compose.js.map +1 -0
  15. package/dist/index.d.ts +21 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +20 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/render.d.ts +6 -0
  20. package/dist/render.d.ts.map +1 -0
  21. package/dist/render.js +13 -0
  22. package/dist/render.js.map +1 -0
  23. package/dist/resolve.d.ts +18 -0
  24. package/dist/resolve.d.ts.map +1 -0
  25. package/dist/resolve.js +67 -0
  26. package/dist/resolve.js.map +1 -0
  27. package/dist/themes/catppuccin.d.ts +3 -0
  28. package/dist/themes/catppuccin.d.ts.map +1 -0
  29. package/dist/themes/catppuccin.js +132 -0
  30. package/dist/themes/catppuccin.js.map +1 -0
  31. package/dist/themes/default.d.ts +3 -0
  32. package/dist/themes/default.d.ts.map +1 -0
  33. package/dist/themes/default.js +131 -0
  34. package/dist/themes/default.js.map +1 -0
  35. package/dist/themes/dracula.d.ts +3 -0
  36. package/dist/themes/dracula.d.ts.map +1 -0
  37. package/dist/themes/dracula.js +69 -0
  38. package/dist/themes/dracula.js.map +1 -0
  39. package/dist/themes/github.d.ts +3 -0
  40. package/dist/themes/github.d.ts.map +1 -0
  41. package/dist/themes/github.js +132 -0
  42. package/dist/themes/github.js.map +1 -0
  43. package/dist/themes/gruvbox.d.ts +3 -0
  44. package/dist/themes/gruvbox.d.ts.map +1 -0
  45. package/dist/themes/gruvbox.js +134 -0
  46. package/dist/themes/gruvbox.js.map +1 -0
  47. package/dist/themes/monokai.d.ts +3 -0
  48. package/dist/themes/monokai.d.ts.map +1 -0
  49. package/dist/themes/monokai.js +69 -0
  50. package/dist/themes/monokai.js.map +1 -0
  51. package/dist/themes/nord.d.ts +3 -0
  52. package/dist/themes/nord.d.ts.map +1 -0
  53. package/dist/themes/nord.js +68 -0
  54. package/dist/themes/nord.js.map +1 -0
  55. package/dist/themes/one-dark.d.ts +3 -0
  56. package/dist/themes/one-dark.d.ts.map +1 -0
  57. package/dist/themes/one-dark.js +69 -0
  58. package/dist/themes/one-dark.js.map +1 -0
  59. package/dist/themes/picotera.d.ts +3 -0
  60. package/dist/themes/picotera.d.ts.map +1 -0
  61. package/dist/themes/picotera.js +136 -0
  62. package/dist/themes/picotera.js.map +1 -0
  63. package/dist/themes/solarized.d.ts +3 -0
  64. package/dist/themes/solarized.d.ts.map +1 -0
  65. package/dist/themes/solarized.js +130 -0
  66. package/dist/themes/solarized.js.map +1 -0
  67. package/dist/themes/tokyo-night.d.ts +3 -0
  68. package/dist/themes/tokyo-night.d.ts.map +1 -0
  69. package/dist/themes/tokyo-night.js +68 -0
  70. package/dist/themes/tokyo-night.js.map +1 -0
  71. package/dist/themes/vs.d.ts +3 -0
  72. package/dist/themes/vs.d.ts.map +1 -0
  73. package/dist/themes/vs.js +132 -0
  74. package/dist/themes/vs.js.map +1 -0
  75. package/dist/tokens.d.ts +7 -0
  76. package/dist/tokens.d.ts.map +1 -0
  77. package/dist/tokens.js +61 -0
  78. package/dist/tokens.js.map +1 -0
  79. package/dist/types.d.ts +101 -0
  80. package/dist/types.d.ts.map +1 -0
  81. package/dist/types.js +2 -0
  82. package/dist/types.js.map +1 -0
  83. package/dist/xterm.d.ts +29 -0
  84. package/dist/xterm.d.ts.map +1 -0
  85. package/dist/xterm.js +31 -0
  86. package/dist/xterm.js.map +1 -0
  87. package/package.json +37 -3
package/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright 2026 the orzui team
4
+ Copyright 2026 the todou team
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,3 +1,129 @@
1
- # Temporary Holding Version
1
+ # @orz/themes
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Theme palettes for `@orz/ui` and for terminals, as plain data, with the pure functions that resolve,
4
+ render and compose them. The package has no React, no DOM and no dependencies. `@orz/ui`'s theme
5
+ store paints these themes; anything else can read them too.
6
+
7
+ ```bash
8
+ pnpm add @orz/themes
9
+ ```
10
+
11
+ ## Model
12
+
13
+ A theme has a palette per color scheme, and a palette can have variants:
14
+
15
+ ```ts
16
+ const theme: Theme = {
17
+ id: "solarized",
18
+ label: "Solarized",
19
+ light: { tokens: { … }, terminal: { … }, syntax: "solarized-light" },
20
+ dark: {
21
+ tokens: { … },
22
+ terminal: { … },
23
+ syntax: "solarized-dark",
24
+ variants: { amoled: { label: "AMOLED", tokens: { background: "oklch(0 0 0)", … } } },
25
+ },
26
+ };
27
+ ```
28
+
29
+ - `light` and `dark` are the color scheme, the same axis as CSS `color-scheme`. A theme has at
30
+ least one of them.
31
+ - Every palette carries two token groups. `tokens` are the UI custom properties `@orz/ui` paints
32
+ with (`background`, `primary`, `sidebar-border`, …), as `oklch()` or hex. `terminal` holds a
33
+ terminal's own background, foreground, cursor and selection and the 16 ANSI colours, as
34
+ `#rrggbb` or `#rrggbbaa`, because terminal sources publish hex and xterm.js does not parse
35
+ `oklch()`.
36
+ - `syntax` names the shiki theme from pierre's bundled collection that `@orz/ui-code` highlights
37
+ with. Without it, code uses pierre's own colours.
38
+ - A variant is a partial override of one palette's tokens, and it is chosen for the whole theme.
39
+ Picking AMOLED applies it to every palette that defines it, and a palette without it shows its
40
+ default. An id means the same on both sides of a theme, so both palettes give it the same label.
41
+ - A **terminal-only theme** (`TerminalTheme`) has terminal tokens and no UI tokens. It can be
42
+ picked for a terminal, and it can be used before a UI mapping for it exists. Every `Theme` is
43
+ also a `TerminalTheme`, so a terminal can follow any UI theme.
44
+
45
+ Themes are plain JSON with no functions or classes, so a theme built by hand, imported or composed
46
+ can be stored, sent and compared like a built-in one.
47
+
48
+ ## Themes
49
+
50
+ `builtinThemes` lists every built-in theme. Each one is also its own module, so an app that ships
51
+ three themes bundles three:
52
+
53
+ ```ts
54
+ import { dracula } from "@orz/themes/themes/dracula";
55
+ import { github } from "@orz/themes/themes/github";
56
+ ```
57
+
58
+ | Theme | Light | Dark |
59
+ |---|---|---|
60
+ | `defaultTheme` (`default`) | ✓ | ✓ |
61
+ | `picotera` | Pico | Tera |
62
+ | `solarized` | ✓ | ✓ |
63
+ | `vs` (Visual Studio) | ✓ | ✓ |
64
+ | `github` | ✓ | ✓ |
65
+ | `catppuccin` | Latte | Mocha |
66
+ | `gruvbox` | ✓ | ✓ |
67
+ | `dracula` | | ✓ |
68
+ | `nord` | | ✓ |
69
+ | `tokyoNight` (`tokyo-night`) | | ✓ |
70
+ | `oneDark` (`one-dark`) | | ✓ |
71
+ | `monokai` | | ✓ |
72
+
73
+ Every dark palette has an `amoled` variant.
74
+
75
+ To add a theme, write a module in `src/themes/` and add it to `builtinThemes` in `src/builtin.ts`
76
+ and to the exports in `src/index.ts`. The tests check every palette's tokens, its contrast, its
77
+ shiki name and its JSON round trip.
78
+
79
+ ## Functions
80
+
81
+ - `resolvePalette(theme, scheme, variant?)` returns the palette with the variant applied, or null
82
+ when the theme has no palette for that scheme. An unknown variant resolves to `default`.
83
+ `resolveTerminal` does the same for terminal tokens and accepts terminal-only themes.
84
+ - `schemesOf(theme)`, `variantsOf(theme)` and `isUiTheme(theme)` describe a theme for a picker.
85
+ - `renderDeclarations(tokens, scheme)` and `renderTerminalDeclarations(terminal)` return the CSS
86
+ declarations for a rule body (`color-scheme: dark; --background: …;`).
87
+ - `amoled(palette)` derives the AMOLED variant of a dark palette. The panels (`background`, `card`,
88
+ `popover`, `sidebar`) drop by the background's lightness, so the background becomes pure black
89
+ and the rest stay near it. Highlights, fills and opaque borders (`accent`, `muted`, `secondary`,
90
+ `border`, …) keep their contrast with the background instead, so a hovered row or a menu
91
+ highlight reads as clearly on black as on the dark palette. Every token keeps its hue and
92
+ chroma. Text, primary, chart, diff and ring tokens, and values carrying
93
+ alpha, stay as they are, and the terminal background becomes `#000000`. A theme opts in with
94
+ `variants: { amoled: amoled(palette) }`, and can spread over the result to retune a token.
95
+ - `composeTheme(custom, themes)` turns a `CustomTheme` into a `Theme` against the current list.
96
+ Each side either bases on a theme (`{ base: { theme, variant? }, tokens? }`) and overrides some
97
+ tokens, or is detached (`{ tokens, terminal }`) and owns all of them. A side's terminal can base
98
+ on any theme in the list, terminal-only ones included, with an optional `scheme`. A side whose
99
+ base is missing is dropped, and the result is null when no side is left. Compose again whenever
100
+ the list changes, so a custom theme follows its base.
101
+ - `composeTerminalTheme(custom, themes)` does the same for a `CustomTerminalTheme`
102
+ (`kind: "terminal"`), a custom theme made of terminal colours alone. Each side is a
103
+ `CustomTerminal`, resolved exactly as a UI side's terminal is, and the result is a
104
+ `TerminalTheme` whose palettes carry `terminal` only. A `CustomTheme` has no `kind`, or
105
+ `kind: "ui"`; `isCustomTerminalTheme(custom)` tells the two apart in an `AnyCustomTheme` list.
106
+ - `xtermTheme(terminal)` maps terminal tokens onto xterm.js's `ITheme` field names:
107
+ `terminal.options.theme = xtermTheme(tokens)`.
108
+
109
+ ## Sources
110
+
111
+ The UI tokens were ported from `@orz/ui`'s earlier stylesheet. The terminal tokens come from each
112
+ theme's upstream terminal palette; `terminal-background` and `terminal-foreground` are the
113
+ palette's own background and foreground, so a terminal sits on the page's surface. Where upstream
114
+ sets no cursor, the cursor is the foreground (Monokai takes its editor cursor, `#f8f8f0`), and
115
+ where it sets no selection, the selection is VS Code's fallback.
116
+
117
+ | Theme | Terminal palette | Licence |
118
+ |---|---|---|
119
+ | Default, Visual Studio | [VS Code Light+ / Dark+ defaults](https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.ts) | MIT |
120
+ | Picotera | derived from its own hues (see the module) | — |
121
+ | Solarized | [Solarized](https://github.com/altercation/solarized) | MIT |
122
+ | GitHub | [primer/github-vscode-theme](https://github.com/primer/github-vscode-theme) 6.3.5 | MIT |
123
+ | Catppuccin | [catppuccin/palette](https://github.com/catppuccin/palette) 1.8.0 | MIT |
124
+ | Gruvbox | [morhetz/gruvbox](https://github.com/morhetz/gruvbox), medium contrast | MIT/X11 per its README; the repository has no licence file |
125
+ | Dracula | [Dracula spec](https://github.com/dracula/spec) | MIT |
126
+ | Nord | [nordtheme/alacritty](https://github.com/nordtheme/alacritty) | MIT |
127
+ | Tokyo Night | [folke/tokyonight.nvim](https://github.com/folke/tokyonight.nvim) "night" | MIT header on the generated extras; the repository is Apache-2.0 |
128
+ | One Dark | [One Dark Pro](https://github.com/Binaryify/OneDark-Pro) | MIT |
129
+ | Monokai | [VS Code's built-in Monokai](https://github.com/microsoft/vscode/tree/main/extensions/theme-monokai) | MIT |
@@ -0,0 +1,16 @@
1
+ import type { TerminalTokens, Tokens, Variant } from "./types.ts";
2
+ /**
3
+ * The AMOLED variant for a dark palette. The panels (background, card,
4
+ * popover, sidebar) drop by the background's lightness, so the background
5
+ * lands on pure black and the rest stay near it. Highlights, fills and opaque
6
+ * borders instead keep their WCAG contrast with the background: luminance
7
+ * goes roughly as L³, so the same lightness step that reads on the dark
8
+ * background all but vanishes at black. Hue and chroma are kept throughout. A
9
+ * value it cannot parse is left out, so the palette's own shows through; one
10
+ * carrying alpha already composites over whatever is beneath it.
11
+ */
12
+ export declare function amoled(palette: {
13
+ tokens: Tokens;
14
+ terminal: TerminalTokens;
15
+ }): Variant;
16
+ //# sourceMappingURL=amoled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amoled.d.ts","sourceRoot":"","sources":["../src/amoled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAa,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAsD7E;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,cAAc,CAAC;CAC1B,GAAG,OAAO,CAqCV"}
package/dist/amoled.js ADDED
@@ -0,0 +1,95 @@
1
+ const PANELS = [
2
+ "background",
3
+ "card",
4
+ "popover",
5
+ "sidebar",
6
+ ];
7
+ const LIFTED = [
8
+ "secondary",
9
+ "muted",
10
+ "accent",
11
+ "sidebar-accent",
12
+ "border",
13
+ "input",
14
+ "sidebar-border",
15
+ ];
16
+ /** `oklch(L C H)` with no alpha; anything else (hex, alpha, var()) is null. */
17
+ function parse(value) {
18
+ const m = /^oklch\(\s*([\d.]+)\s+([\d.]+)\s+([\d.]+)\s*\)$/.exec(value);
19
+ return m ? [Number(m[1]), m[2], m[3]] : null;
20
+ }
21
+ /** WCAG relative luminance through CSS Color 4's Oklab matrices, not clamped to sRGB. */
22
+ function luminance(lightness, chroma, hue) {
23
+ const a = chroma * Math.cos((hue * Math.PI) / 180);
24
+ const b = chroma * Math.sin((hue * Math.PI) / 180);
25
+ const long = (lightness + 0.3963377774 * a + 0.2158037573 * b) ** 3;
26
+ const medium = (lightness - 0.1055613458 * a - 0.0638541728 * b) ** 3;
27
+ const short = (lightness - 0.0894841775 * a - 1.291485548 * b) ** 3;
28
+ return (0.2126 *
29
+ (4.0767416621 * long - 3.3077115913 * medium + 0.2309699292 * short) +
30
+ 0.7152 *
31
+ (-1.2684380046 * long + 2.6097574011 * medium - 0.3413193965 * short) +
32
+ 0.0722 *
33
+ (-0.0041960863 * long - 0.7034186147 * medium + 1.707614701 * short));
34
+ }
35
+ /** The lightness at which this chroma and hue reach `target` luminance. */
36
+ function lightnessFor(target, chroma, hue) {
37
+ let low = 0;
38
+ let high = 1;
39
+ for (let i = 0; i < 30; i++) {
40
+ const mid = (low + high) / 2;
41
+ if (luminance(mid, chroma, hue) < target)
42
+ low = mid;
43
+ else
44
+ high = mid;
45
+ }
46
+ return high;
47
+ }
48
+ /**
49
+ * The AMOLED variant for a dark palette. The panels (background, card,
50
+ * popover, sidebar) drop by the background's lightness, so the background
51
+ * lands on pure black and the rest stay near it. Highlights, fills and opaque
52
+ * borders instead keep their WCAG contrast with the background: luminance
53
+ * goes roughly as L³, so the same lightness step that reads on the dark
54
+ * background all but vanishes at black. Hue and chroma are kept throughout. A
55
+ * value it cannot parse is left out, so the palette's own shows through; one
56
+ * carrying alpha already composites over whatever is beneath it.
57
+ */
58
+ export function amoled(palette) {
59
+ const tokens = {};
60
+ const background = parse(palette.tokens.background);
61
+ if (background !== null) {
62
+ const [bl, bc, bh] = background;
63
+ for (const name of PANELS) {
64
+ const surface = parse(palette.tokens[name]);
65
+ if (surface === null)
66
+ continue;
67
+ // Rounded so float error never prints 0.10000000000000003.
68
+ const lightness = Math.round((surface[0] - bl) * 1e4) / 1e4;
69
+ // Chroma means nothing at zero lightness; say black plainly.
70
+ tokens[name] =
71
+ lightness <= 0
72
+ ? "oklch(0 0 0)"
73
+ : `oklch(${lightness} ${surface[1]} ${surface[2]})`;
74
+ }
75
+ const base = luminance(bl, Number(bc), Number(bh)) + 0.05;
76
+ for (const name of LIFTED) {
77
+ const surface = parse(palette.tokens[name]);
78
+ if (surface === null)
79
+ continue;
80
+ const [l, c, h] = surface;
81
+ const ratio = (luminance(l, Number(c), Number(h)) + 0.05) / base;
82
+ // Black's luminance is 0, so this ratio against it needs 0.05·(ratio − 1);
83
+ // rounded up so the contrast never lands under it.
84
+ const lightness = Math.ceil(lightnessFor(0.05 * (ratio - 1), Number(c), Number(h)) * 1e3) / 1e3;
85
+ tokens[name] =
86
+ ratio <= 1 ? "oklch(0 0 0)" : `oklch(${lightness} ${c} ${h})`;
87
+ }
88
+ }
89
+ return {
90
+ label: "AMOLED",
91
+ tokens,
92
+ terminal: { "terminal-background": "#000000" },
93
+ };
94
+ }
95
+ //# sourceMappingURL=amoled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amoled.js","sourceRoot":"","sources":["../src/amoled.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAyB;IACnC,YAAY;IACZ,MAAM;IACN,SAAS;IACT,SAAS;CACV,CAAC;AAEF,MAAM,MAAM,GAAyB;IACnC,WAAW;IACX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,SAAS,EAAE;KAC/C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Theme } from "./types.ts";
2
+ /** Every built-in theme, two-palette themes first. */
3
+ export declare const builtinThemes: readonly Theme[];
4
+ //# sourceMappingURL=builtin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../src/builtin.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,sDAAsD;AACtD,eAAO,MAAM,aAAa,EAAE,SAAS,KAAK,EAazC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { catppuccin } from "./themes/catppuccin.js";
2
+ import { defaultTheme } from "./themes/default.js";
3
+ import { dracula } from "./themes/dracula.js";
4
+ import { github } from "./themes/github.js";
5
+ import { gruvbox } from "./themes/gruvbox.js";
6
+ import { monokai } from "./themes/monokai.js";
7
+ import { nord } from "./themes/nord.js";
8
+ import { oneDark } from "./themes/one-dark.js";
9
+ import { picotera } from "./themes/picotera.js";
10
+ import { solarized } from "./themes/solarized.js";
11
+ import { tokyoNight } from "./themes/tokyo-night.js";
12
+ import { vs } from "./themes/vs.js";
13
+ /** Every built-in theme, two-palette themes first. */
14
+ export const builtinThemes = [
15
+ defaultTheme,
16
+ picotera,
17
+ solarized,
18
+ vs,
19
+ github,
20
+ catppuccin,
21
+ gruvbox,
22
+ dracula,
23
+ nord,
24
+ tokyoNight,
25
+ oneDark,
26
+ monokai,
27
+ ];
28
+ //# sourceMappingURL=builtin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin.js","sourceRoot":"","sources":["../src/builtin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAGpC,sDAAsD;AACtD,MAAM,CAAC,MAAM,aAAa,GAAqB;IAC7C,YAAY;IACZ,QAAQ;IACR,SAAS;IACT,EAAE;IACF,MAAM;IACN,UAAU;IACV,OAAO;IACP,OAAO;IACP,IAAI;IACJ,UAAU;IACV,OAAO;IACP,OAAO;CACR,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { AnyCustomTheme, CustomTerminalTheme, CustomTheme, TerminalTheme, Theme } from "./types.ts";
2
+ /**
3
+ * A custom theme made into an ordinary `Theme` against the current lists.
4
+ * `themes` may include terminal-only themes, used only as terminal bases.
5
+ * null when no side survives, and the caller leaves the theme out.
6
+ */
7
+ export declare function composeTheme(custom: CustomTheme, themes: readonly TerminalTheme[]): Theme | null;
8
+ export declare function isCustomTerminalTheme(custom: AnyCustomTheme): custom is CustomTerminalTheme;
9
+ /**
10
+ * A terminal custom theme made into an ordinary `TerminalTheme`, each side
11
+ * resolved as a UI side's terminal is. null when no side survives.
12
+ */
13
+ export declare function composeTerminalTheme(custom: CustomTerminalTheme, themes: readonly TerminalTheme[]): TerminalTheme | null;
14
+ //# sourceMappingURL=compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EAId,mBAAmB,EACnB,WAAW,EAGX,aAAa,EAEb,KAAK,EACN,MAAM,YAAY,CAAC;AA+CpB;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,SAAS,aAAa,EAAE,GAC/B,KAAK,GAAG,IAAI,CASd;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,cAAc,GACrB,MAAM,IAAI,mBAAmB,CAE/B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,SAAS,aAAa,EAAE,GAC/B,aAAa,GAAG,IAAI,CAetB"}
@@ -0,0 +1,75 @@
1
+ import { isUiTheme, resolvePalette, resolveTerminal } from "./resolve.js";
2
+ function resolveCustomTerminal(custom, scheme, themes) {
3
+ if (!("base" in custom))
4
+ return { ...custom.tokens };
5
+ const base = themes.find((t) => t.id === custom.base.theme);
6
+ if (base === undefined)
7
+ return null;
8
+ // A one-palette base serves either side, so a dark-only terminal can sit
9
+ // under a light UI side without naming the scheme.
10
+ const own = base.light ? (base.dark ? scheme : "light") : "dark";
11
+ const resolved = resolveTerminal(base, custom.base.scheme ?? own, custom.base.variant);
12
+ if (resolved === null)
13
+ return null;
14
+ return { ...resolved.terminal, ...custom.tokens };
15
+ }
16
+ function composeSide(side, scheme, themes) {
17
+ if (!("base" in side)) {
18
+ const terminal = resolveCustomTerminal(side.terminal, scheme, themes);
19
+ if (terminal === null)
20
+ return null;
21
+ return { tokens: { ...side.tokens }, terminal };
22
+ }
23
+ const base = themes.find((t) => t.id === side.base.theme);
24
+ if (base === undefined || !isUiTheme(base))
25
+ return null;
26
+ const resolved = resolvePalette(base, scheme, side.base.variant);
27
+ if (resolved === null)
28
+ return null;
29
+ const terminal = (side.terminal && resolveCustomTerminal(side.terminal, scheme, themes)) ??
30
+ resolved.terminal;
31
+ const palette = {
32
+ tokens: { ...resolved.tokens, ...side.tokens },
33
+ terminal,
34
+ };
35
+ if (resolved.syntax !== undefined)
36
+ palette.syntax = resolved.syntax;
37
+ return palette;
38
+ }
39
+ /**
40
+ * A custom theme made into an ordinary `Theme` against the current lists.
41
+ * `themes` may include terminal-only themes, used only as terminal bases.
42
+ * null when no side survives, and the caller leaves the theme out.
43
+ */
44
+ export function composeTheme(custom, themes) {
45
+ const light = custom.light && composeSide(custom.light, "light", themes);
46
+ const dark = custom.dark && composeSide(custom.dark, "dark", themes);
47
+ if (!light && !dark)
48
+ return null;
49
+ const theme = { id: custom.id, label: custom.label };
50
+ if (light)
51
+ theme.light = light;
52
+ if (dark)
53
+ theme.dark = dark;
54
+ return theme;
55
+ }
56
+ export function isCustomTerminalTheme(custom) {
57
+ return custom.kind === "terminal";
58
+ }
59
+ /**
60
+ * A terminal custom theme made into an ordinary `TerminalTheme`, each side
61
+ * resolved as a UI side's terminal is. null when no side survives.
62
+ */
63
+ export function composeTerminalTheme(custom, themes) {
64
+ const light = custom.light && resolveCustomTerminal(custom.light, "light", themes);
65
+ const dark = custom.dark && resolveCustomTerminal(custom.dark, "dark", themes);
66
+ if (!light && !dark)
67
+ return null;
68
+ const theme = { id: custom.id, label: custom.label };
69
+ if (light)
70
+ theme.light = { terminal: light };
71
+ if (dark)
72
+ theme.dark = { terminal: dark };
73
+ return theme;
74
+ }
75
+ //# sourceMappingURL=compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAe1E,SAAS,qBAAqB,CAC5B,MAAsB,EACtB,MAAmB,EACnB,MAAgC;IAEhC,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC;QAAE,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;IACrD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,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U,qBAAqB,CACnC,MAAsB;IAEtB,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAA2B,EAC3B,MAAgC;IAEhC,MAAM,KAAK,GACT,MAAM,CAAC,KAAK,IAAI,qBAAqB,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACvE,MAAM,IAAI,GACR,MAAM,CAAC,IAAI,IAAI,qBAAqB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpE,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACjC,MAAM,KAAK,GAKP,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;IAC3C,IAAI,KAAK;QAAE,KAAK,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC7C,IAAI,IAAI;QAAE,KAAK,CAAC,IAAI,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1C,OAAO,KAAsB,CAAC;AAChC,CAAC"}
@@ -0,0 +1,21 @@
1
+ export { amoled } from "./amoled.ts";
2
+ export { builtinThemes } from "./builtin.ts";
3
+ export { composeTerminalTheme, composeTheme, isCustomTerminalTheme, } from "./compose.ts";
4
+ export { renderDeclarations, renderTerminalDeclarations } from "./render.ts";
5
+ export { isUiTheme, resolvePalette, resolveTerminal, schemesOf, variantsOf, } from "./resolve.ts";
6
+ export { catppuccin } from "./themes/catppuccin.ts";
7
+ export { defaultTheme } from "./themes/default.ts";
8
+ export { dracula } from "./themes/dracula.ts";
9
+ export { github } from "./themes/github.ts";
10
+ export { gruvbox } from "./themes/gruvbox.ts";
11
+ export { monokai } from "./themes/monokai.ts";
12
+ export { nord } from "./themes/nord.ts";
13
+ export { oneDark } from "./themes/one-dark.ts";
14
+ export { picotera } from "./themes/picotera.ts";
15
+ export { solarized } from "./themes/solarized.ts";
16
+ export { tokyoNight } from "./themes/tokyo-night.ts";
17
+ export { vs } from "./themes/vs.ts";
18
+ export { DEFAULT_VARIANT, TERMINAL_TOKEN_NAMES, TOKEN_NAMES, } from "./tokens.ts";
19
+ export type { AnyCustomTheme, ColorScheme, CustomSide, CustomTerminal, CustomTerminalTheme, CustomTheme, Palette, ResolvedPalette, ResolvedTerminal, TerminalPalette, TerminalTheme, TerminalTokenName, TerminalTokens, TerminalVariant, Theme, TokenName, Tokens, Variant, } from "./types.ts";
20
+ export { xtermTheme } from "./xterm.ts";
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EACL,SAAS,EACT,cAAc,EACd,eAAe,EACf,SAAS,EACT,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,cAAc,EACd,WAAW,EACX,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,KAAK,EACL,SAAS,EACT,MAAM,EACN,OAAO,GACR,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ export { amoled } from "./amoled.js";
2
+ export { builtinThemes } from "./builtin.js";
3
+ export { composeTerminalTheme, composeTheme, isCustomTerminalTheme, } from "./compose.js";
4
+ export { renderDeclarations, renderTerminalDeclarations } from "./render.js";
5
+ export { isUiTheme, resolvePalette, resolveTerminal, schemesOf, variantsOf, } from "./resolve.js";
6
+ export { catppuccin } from "./themes/catppuccin.js";
7
+ export { defaultTheme } from "./themes/default.js";
8
+ export { dracula } from "./themes/dracula.js";
9
+ export { github } from "./themes/github.js";
10
+ export { gruvbox } from "./themes/gruvbox.js";
11
+ export { monokai } from "./themes/monokai.js";
12
+ export { nord } from "./themes/nord.js";
13
+ export { oneDark } from "./themes/one-dark.js";
14
+ export { picotera } from "./themes/picotera.js";
15
+ export { solarized } from "./themes/solarized.js";
16
+ export { tokyoNight } from "./themes/tokyo-night.js";
17
+ export { vs } from "./themes/vs.js";
18
+ export { DEFAULT_VARIANT, TERMINAL_TOKEN_NAMES, TOKEN_NAMES, } from "./tokens.js";
19
+ export { xtermTheme } from "./xterm.js";
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EACL,SAAS,EACT,cAAc,EACd,eAAe,EACf,SAAS,EACT,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,WAAW,GACZ,MAAM,aAAa,CAAC;AAqBrB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ColorScheme, TerminalTokens, Tokens } from "./types.ts";
2
+ /** "color-scheme: dark; --background: oklch(…); …" — UI tokens only; no selector, no braces. */
3
+ export declare function renderDeclarations(tokens: Tokens, scheme: ColorScheme): string;
4
+ /** "--terminal-background: #…; …; --ansi-bright-white: #…;" */
5
+ export declare function renderTerminalDeclarations(terminal: TerminalTokens): string;
6
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEtE,gGAAgG;AAChG,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,GAClB,MAAM,CAKR;AAED,+DAA+D;AAC/D,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAI3E"}
package/dist/render.js ADDED
@@ -0,0 +1,13 @@
1
+ import { TERMINAL_TOKEN_NAMES, TOKEN_NAMES } from "./tokens.js";
2
+ /** "color-scheme: dark; --background: oklch(…); …" — UI tokens only; no selector, no braces. */
3
+ export function renderDeclarations(tokens, scheme) {
4
+ return [
5
+ `color-scheme: ${scheme};`,
6
+ ...TOKEN_NAMES.map((name) => `--${name}: ${tokens[name]};`),
7
+ ].join(" ");
8
+ }
9
+ /** "--terminal-background: #…; …; --ansi-bright-white: #…;" */
10
+ export function renderTerminalDeclarations(terminal) {
11
+ return TERMINAL_TOKEN_NAMES.map((name) => `--${name}: ${terminal[name]};`).join(" ");
12
+ }
13
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGhE,gGAAgG;AAChG,MAAM,UAAU,kBAAkB,CAChC,MAAc,EACd,MAAmB;IAEnB,OAAO;QACL,iBAAiB,MAAM,GAAG;QAC1B,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;KAC5D,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,0BAA0B,CAAC,QAAwB;IACjE,OAAO,oBAAoB,CAAC,GAAG,CAC7B,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,GAAG,CAC1C,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { ColorScheme, ResolvedPalette, ResolvedTerminal, TerminalTheme, Theme } from "./types.ts";
2
+ /** The color schemes the theme has, light first. */
3
+ export declare function schemesOf(theme: TerminalTheme): ColorScheme[];
4
+ /**
5
+ * `default` (label "Default") first, then each id in palette order (light,
6
+ * then dark), once. Throws when two palettes give one id different labels,
7
+ * which would leave a menu showing one entry that means two things.
8
+ */
9
+ export declare function variantsOf(theme: TerminalTheme): {
10
+ id: string;
11
+ label: string;
12
+ }[];
13
+ /** True when every palette of the theme carries UI tokens. */
14
+ export declare function isUiTheme(theme: TerminalTheme): theme is Theme;
15
+ /** null when the theme has no palette for `scheme`. An unknown variant resolves to default. */
16
+ export declare function resolvePalette(theme: Theme, scheme: ColorScheme, variant?: string): ResolvedPalette | null;
17
+ export declare function resolveTerminal(theme: TerminalTheme, scheme: ColorScheme, variant?: string): ResolvedTerminal | null;
18
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EAEX,eAAe,EACf,gBAAgB,EAEhB,aAAa,EACb,KAAK,EACN,MAAM,YAAY,CAAC;AAIpB,oDAAoD;AACpD,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,WAAW,EAAE,CAE7D;AAcD;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,aAAa,GACnB;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAgBjC;AAED,8DAA8D;AAC9D,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,IAAI,KAAK,CAI9D;AAED,+FAA+F;AAC/F,wBAAgB,cAAc,CAC5B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,MAAM,GACf,eAAe,GAAG,IAAI,CAYxB;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,MAAM,GACf,gBAAgB,GAAG,IAAI,CAQzB"}
@@ -0,0 +1,67 @@
1
+ import { DEFAULT_VARIANT } from "./tokens.js";
2
+ const SCHEMES = ["light", "dark"];
3
+ /** The color schemes the theme has, light first. */
4
+ export function schemesOf(theme) {
5
+ return SCHEMES.filter((scheme) => theme[scheme] !== undefined);
6
+ }
7
+ // Own keys only: a variant id comes from a stored pref, and "constructor"
8
+ // must not find Object.prototype's.
9
+ function variantOf(variants, id) {
10
+ if (id === undefined || id === DEFAULT_VARIANT || variants === undefined) {
11
+ return undefined;
12
+ }
13
+ return Object.hasOwn(variants, id) ? variants[id] : undefined;
14
+ }
15
+ /**
16
+ * `default` (label "Default") first, then each id in palette order (light,
17
+ * then dark), once. Throws when two palettes give one id different labels,
18
+ * which would leave a menu showing one entry that means two things.
19
+ */
20
+ export function variantsOf(theme) {
21
+ const out = [{ id: DEFAULT_VARIANT, label: "Default" }];
22
+ for (const scheme of schemesOf(theme)) {
23
+ const variants = theme[scheme]?.variants ?? {};
24
+ for (const [id, { label }] of Object.entries(variants)) {
25
+ if (id === DEFAULT_VARIANT)
26
+ continue;
27
+ const seen = out.find((v) => v.id === id);
28
+ if (seen === undefined)
29
+ out.push({ id, label });
30
+ else if (seen.label !== label) {
31
+ throw new Error(`theme ${theme.id}: variant ${id} is "${seen.label}" on one side and "${label}" on the other`);
32
+ }
33
+ }
34
+ }
35
+ return out;
36
+ }
37
+ /** True when every palette of the theme carries UI tokens. */
38
+ export function isUiTheme(theme) {
39
+ return schemesOf(theme).every((scheme) => theme[scheme].tokens !== undefined);
40
+ }
41
+ /** null when the theme has no palette for `scheme`. An unknown variant resolves to default. */
42
+ export function resolvePalette(theme, scheme, variant) {
43
+ const palette = theme[scheme];
44
+ if (palette === undefined)
45
+ return null;
46
+ const picked = variantOf(palette.variants, variant);
47
+ const resolved = {
48
+ tokens: { ...palette.tokens, ...picked?.tokens },
49
+ terminal: { ...palette.terminal, ...picked?.terminal },
50
+ variant: picked === undefined ? DEFAULT_VARIANT : variant,
51
+ };
52
+ const syntax = picked?.syntax ?? palette.syntax;
53
+ if (syntax !== undefined)
54
+ resolved.syntax = syntax;
55
+ return resolved;
56
+ }
57
+ export function resolveTerminal(theme, scheme, variant) {
58
+ const palette = theme[scheme];
59
+ if (palette === undefined)
60
+ return null;
61
+ const picked = variantOf(palette.variants, variant);
62
+ return {
63
+ terminal: { ...palette.terminal, ...picked?.terminal },
64
+ variant: picked === undefined ? DEFAULT_VARIANT : variant,
65
+ };
66
+ }
67
+ //# sourceMappingURL=resolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAW9C,MAAM,OAAO,GAA2B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAE1D,oDAAoD;AACpD,MAAM,UAAU,SAAS,CAAC,KAAoB;IAC5C,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CA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,IAAI,CAAC;IACvC,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpD,OAAO;QACL,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE;QACtD,OAAO,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAE,OAAkB;KACtE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Theme } from "../types.ts";
2
+ export declare const catppuccin: Theme;
3
+ //# sourceMappingURL=catppuccin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catppuccin.d.ts","sourceRoot":"","sources":["../../src/themes/catppuccin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAW,KAAK,EAAE,MAAM,aAAa,CAAC;AAgIlD,eAAO,MAAM,UAAU,EAAE,KAKxB,CAAC"}