@adea-ai/themes 0.1.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 (109) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +110 -0
  3. package/README.md +157 -0
  4. package/dist/adapters/base24.d.ts +117 -0
  5. package/dist/adapters/base24.d.ts.map +1 -0
  6. package/dist/adapters/base24.js +313 -0
  7. package/dist/adapters/base24.js.map +1 -0
  8. package/dist/adapters/css.d.ts +68 -0
  9. package/dist/adapters/css.d.ts.map +1 -0
  10. package/dist/adapters/css.js +107 -0
  11. package/dist/adapters/css.js.map +1 -0
  12. package/dist/adapters/shadcn.d.ts +43 -0
  13. package/dist/adapters/shadcn.d.ts.map +1 -0
  14. package/dist/adapters/shadcn.js +89 -0
  15. package/dist/adapters/shadcn.js.map +1 -0
  16. package/dist/adapters/shiki.d.ts +60 -0
  17. package/dist/adapters/shiki.d.ts.map +1 -0
  18. package/dist/adapters/shiki.js +135 -0
  19. package/dist/adapters/shiki.js.map +1 -0
  20. package/dist/adapters/tailwind.d.ts +35 -0
  21. package/dist/adapters/tailwind.d.ts.map +1 -0
  22. package/dist/adapters/tailwind.js +58 -0
  23. package/dist/adapters/tailwind.js.map +1 -0
  24. package/dist/adapters/xterm.d.ts +64 -0
  25. package/dist/adapters/xterm.d.ts.map +1 -0
  26. package/dist/adapters/xterm.js +112 -0
  27. package/dist/adapters/xterm.js.map +1 -0
  28. package/dist/catalogue.d.ts +66 -0
  29. package/dist/catalogue.d.ts.map +1 -0
  30. package/dist/catalogue.js +110 -0
  31. package/dist/catalogue.js.map +1 -0
  32. package/dist/derive.d.ts +89 -0
  33. package/dist/derive.d.ts.map +1 -0
  34. package/dist/derive.js +165 -0
  35. package/dist/derive.js.map +1 -0
  36. package/dist/generated/schemes.d.ts +16 -0
  37. package/dist/generated/schemes.d.ts.map +1 -0
  38. package/dist/generated/schemes.js +880 -0
  39. package/dist/generated/schemes.js.map +1 -0
  40. package/dist/generated/themes.d.ts +11 -0
  41. package/dist/generated/themes.d.ts.map +1 -0
  42. package/dist/generated/themes.js +1650 -0
  43. package/dist/generated/themes.js.map +1 -0
  44. package/dist/index.d.ts +67 -0
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +58 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/normalize.d.ts +160 -0
  49. package/dist/normalize.d.ts.map +1 -0
  50. package/dist/normalize.js +795 -0
  51. package/dist/normalize.js.map +1 -0
  52. package/dist/oklch.d.ts +141 -0
  53. package/dist/oklch.d.ts.map +1 -0
  54. package/dist/oklch.js +306 -0
  55. package/dist/oklch.js.map +1 -0
  56. package/dist/schema.d.ts +178 -0
  57. package/dist/schema.d.ts.map +1 -0
  58. package/dist/schema.js +69 -0
  59. package/dist/schema.js.map +1 -0
  60. package/dist/sources.d.ts +171 -0
  61. package/dist/sources.d.ts.map +1 -0
  62. package/dist/sources.js +559 -0
  63. package/dist/sources.js.map +1 -0
  64. package/dist/validate.d.ts +121 -0
  65. package/dist/validate.d.ts.map +1 -0
  66. package/dist/validate.js +255 -0
  67. package/dist/validate.js.map +1 -0
  68. package/package.json +106 -0
  69. package/palettes/ayu-light.json +38 -0
  70. package/palettes/ayu-mirage.json +38 -0
  71. package/palettes/ayu.json +38 -0
  72. package/palettes/catppuccin-frappe.json +38 -0
  73. package/palettes/catppuccin-latte.json +38 -0
  74. package/palettes/catppuccin-macchiato.json +38 -0
  75. package/palettes/catppuccin-mocha.json +38 -0
  76. package/palettes/dracula.json +38 -0
  77. package/palettes/everforest-dark.json +38 -0
  78. package/palettes/everforest-light.json +38 -0
  79. package/palettes/gruvbox-dark.json +38 -0
  80. package/palettes/gruvbox-light.json +38 -0
  81. package/palettes/kanagawa.json +38 -0
  82. package/palettes/monokai.json +38 -0
  83. package/palettes/nord.json +38 -0
  84. package/palettes/one-dark.json +38 -0
  85. package/palettes/rosepine-dawn.json +38 -0
  86. package/palettes/rosepine-moon.json +38 -0
  87. package/palettes/rosepine.json +38 -0
  88. package/palettes/solarized-dark.json +38 -0
  89. package/palettes/solarized-light.json +38 -0
  90. package/palettes/tokyonight-day.json +38 -0
  91. package/palettes/tokyonight-night.json +38 -0
  92. package/palettes/tokyonight-storm.json +38 -0
  93. package/palettes/vesper.json +38 -0
  94. package/src/adapters/base24.ts +355 -0
  95. package/src/adapters/css.ts +149 -0
  96. package/src/adapters/shadcn.ts +99 -0
  97. package/src/adapters/shiki.ts +168 -0
  98. package/src/adapters/tailwind.ts +79 -0
  99. package/src/adapters/xterm.ts +159 -0
  100. package/src/catalogue.ts +129 -0
  101. package/src/derive.ts +203 -0
  102. package/src/generated/schemes.ts +882 -0
  103. package/src/generated/themes.ts +1652 -0
  104. package/src/index.ts +146 -0
  105. package/src/normalize.ts +1010 -0
  106. package/src/oklch.ts +366 -0
  107. package/src/schema.ts +222 -0
  108. package/src/sources.ts +682 -0
  109. package/src/validate.ts +325 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,110 @@
1
+ Copyright 2026 0xPlayerOne
2
+
3
+ The Adea theme catalogue is distributed under the Apache License, Version 2.0.
4
+ You may obtain a copy of the License at:
5
+
6
+ https://www.apache.org/licenses/LICENSE-2.0
7
+
8
+ Unless required by applicable law or agreed to in writing, software distributed
9
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
11
+ specific language governing permissions and limitations under the License.
12
+
13
+ ---
14
+
15
+ # Third-party palettes
16
+
17
+ Every theme in this package except Adea's own two is **somebody else's palette**,
18
+ reproduced rather than authored. This section records whose, under what terms, and
19
+ where the specific bytes came from. The per-theme machine-readable form of the same
20
+ information is on each catalogue entry's `provenance` field, and
21
+ `tests/provenance.test.ts` asserts that the values match each project's published
22
+ palette.
23
+
24
+ ## The chain of custody
25
+
26
+ The colour values in `palettes/` were not typed in by hand, and they are not read
27
+ from any package at runtime. They were produced once, by
28
+ `scripts/vendor-palettes.ts`, which reproduces the Base24 scheme for each theme from
29
+ one pinned revision of:
30
+
31
+ - **oklch-terminal-themes** — https://github.com/williamzujkowski/oklch-terminal-themes
32
+ — revision `9e800e7fe760081d4c10317498038ed4227341d6` — MIT.
33
+ This is the bootstrap dataset. Its Base24 schemes are, in turn, derived from the
34
+ terminal ports published in:
35
+ - **iTerm2-Color-Schemes** — https://github.com/mbadolato/iTerm2-Color-Schemes — MIT.
36
+
37
+ `oklch-terminal-themes` is a build-time input only. It is not a dependency of this
38
+ package, in either `dependencies` or `devDependencies`, and nothing here reads it at
39
+ run time. What it contributed is a starting set of values, which was then checked
40
+ against each palette's own project before being committed.
41
+
42
+ ## The palettes, and the terms they are used under
43
+
44
+ Each entry names the project the palette belongs to — the place its design is
45
+ defined and the authority on what "Catppuccin Mocha" means — and the licence the
46
+ vendored values are used under. `tests/provenance.test.ts` asserts that the
47
+ background and foreground of every one of these matches the project's published
48
+ palette.
49
+
50
+ | Family | Project | Licence | Vendored values |
51
+ | --- | --- | --- | --- |
52
+ | Adea | this package | Apache-2.0 | authored here |
53
+ | Catppuccin | https://github.com/catppuccin/catppuccin | MIT | via the chain above |
54
+ | Tokyo Night | https://github.com/folke/tokyonight.nvim | Apache-2.0 | via the chain above |
55
+ | Rosé Pine | https://github.com/rose-pine/rose-pine-theme | MIT | via the chain above |
56
+ | Gruvbox | https://github.com/morhetz/gruvbox | MIT | via the chain above |
57
+ | Nord | https://github.com/nordtheme/nord | MIT | via the chain above |
58
+ | Dracula | https://github.com/dracula/dracula-theme | MIT | via the chain above |
59
+ | One Dark | https://github.com/atom/one-dark-syntax | MIT | Atom's own palette |
60
+ | Solarized | https://github.com/altercation/solarized | MIT | via the chain above |
61
+ | Everforest | https://github.com/sainnhe/everforest | MIT | via the chain above |
62
+ | Ayu | https://github.com/ayu-theme/ayu-colors | MIT | via the chain above |
63
+ | Kanagawa | https://github.com/rebelot/kanagawa.nvim | MIT | via the chain above |
64
+ | Vesper | https://github.com/raunofreiberg/vesper | MIT | via the chain above |
65
+ | Monokai | https://monokai.pro (design origin) | MIT | via the chain above |
66
+
67
+ ### Two entries that need a note
68
+
69
+ **Gruvbox** grants the MIT/X11 licence in the *Licence* section of its README and
70
+ ships no `LICENSE` file, which is why automated licence detection reports nothing
71
+ for the repository. The README is the grant, and it is recorded here as MIT. The
72
+ source for this statement is
73
+ https://github.com/morhetz/gruvbox#license.
74
+
75
+ **Monokai** is the one family whose own repository carries no licence at all: the
76
+ repository under the Monokai organisation has none, so there is no permissively
77
+ licensed artefact of Monokai's own to vendor from. The values in this package are
78
+ therefore taken from the MIT-licensed iTerm2-Color-Schemes port through the chain
79
+ above, which is the artefact the MIT licence attaches to, and Monokai is credited as
80
+ the design's origin without a licence claim being made on its behalf. If Monokai's
81
+ terms are ever clarified, this entry should be revisited — and if they turn out to
82
+ be incompatible, `monokai` should be removed from `VENDORED_SOURCES` and the
83
+ catalogue regenerated, which is a one-line change plus a rebuild.
84
+
85
+ ### One deliberate deviation from the vendored values
86
+
87
+ **One Dark** is normalized from Atom's own editor palette rather than from the
88
+ terminal port. iTerm2's One Dark port darkens the canvas to `#21252b` so that a
89
+ terminal window reads as a distinct surface, but "One Dark" as a design means Atom's
90
+ `hsl(220, 13%, 18%)` = `#282c34`, with comments at `#5c6370` rather than the port's
91
+ `#767676`. Adea themes an application, so the project's value is the one used. The
92
+ substitution is declared in `src/sources.ts` and reported as a finding on every
93
+ build.
94
+
95
+ ---
96
+
97
+ # Contrast repairs
98
+
99
+ Some themes in this catalogue do not ship the exact colour a palette specifies for
100
+ every role, because the palette's own value fails a contrast floor on the palette's
101
+ own background. Solarized Light's body text is the clearest case: `#657b83` on
102
+ `#fdf6e3` measures 4.28:1, below the WCAG AA floor of 4.5:1.
103
+
104
+ Where that happens, the value's **lightness** is moved by the smallest amount that
105
+ clears the floor, and nothing else is changed — OKLCH makes that a single-axis edit
106
+ that preserves hue and chroma exactly, and `tests/provenance.test.ts` asserts the hue
107
+ is unmoved. In the rare case where lightness alone cannot reach the floor, the colour
108
+ is blended toward the palette's own foreground, which is recorded on the entry and
109
+ reported on every build. No colour is ever invented: every value in the catalogue is
110
+ a value from the palette it is attributed to, viewed at a different brightness.
package/README.md ADDED
@@ -0,0 +1,157 @@
1
+ # @adea-ai/themes
2
+
3
+ The Adea theme catalogue. Twenty-seven themes — every one an OKLCH theme with the
4
+ full set of semantic surface roles, sixteen ANSI colours, a cursor and a selection —
5
+ normalized from mature upstream palettes, with adapters for the places a theme has
6
+ to arrive in a foreign shape.
7
+
8
+ ```sh
9
+ bun add @adea-ai/themes
10
+ ```
11
+
12
+ ## The catalogue
13
+
14
+ | Family | Variants |
15
+ | --- | --- |
16
+ | **Adea** | Light, Dark |
17
+ | **Catppuccin** | Latte, Frappé, Macchiato, Mocha |
18
+ | **Tokyo Night** | Day, Storm, Night |
19
+ | **Rosé Pine** | Dawn, Moon, Main |
20
+ | **Gruvbox** | Light, Dark |
21
+ | **Everforest** | Light, Dark |
22
+ | **Ayu** | Light, Mirage, Dark |
23
+ | **Solarized** | Light, Dark |
24
+ | **Monokai** | Classic |
25
+ | **Nord**, **Dracula**, **One Dark**, **Kanagawa**, **Vesper** | one each |
26
+
27
+ `adea-light` and `adea-dark` are the defaults. Everything else is somebody else's
28
+ palette, reproduced from a named revision and credited in [NOTICE](NOTICE).
29
+
30
+ ## Using it
31
+
32
+ ```ts
33
+ import { getTheme, themeFamilies, resolveTheme } from '@adea-ai/themes'
34
+ import { themeCssVariables } from '@adea-ai/themes/adapters/css'
35
+ import { toXtermTheme } from '@adea-ai/themes/adapters/xterm'
36
+ import { toShikiTheme } from '@adea-ai/themes/adapters/shiki'
37
+
38
+ // Apply a theme to the document.
39
+ const theme = resolveTheme('catppuccin-mocha', 'dark')
40
+ for (const [name, value] of Object.entries(themeCssVariables(theme))) {
41
+ document.documentElement.style.setProperty(name, value)
42
+ }
43
+
44
+ // Colour a terminal.
45
+ terminal.options.theme = toXtermTheme(theme)
46
+
47
+ // Register a syntax theme.
48
+ const highlighter = await createHighlighter({ themes: [toShikiTheme(theme)], langs: [...] })
49
+ ```
50
+
51
+ Every exported theme value is an `oklch()` string, which means the browser does the
52
+ colour work and a consumer can compose — `color-mix(in oklch, var(--adea-accent),
53
+ transparent 20%)` — and get a predictable result. The adapters that need hex (xterm,
54
+ Shiki) convert, gamut-mapping rather than clipping.
55
+
56
+ ## The design, in four decisions
57
+
58
+ **Adea owns the schema and the transformation, not the colours.** The seventeen
59
+ surface roles in `src/schema.ts` are the contract. No upstream project is asked to
60
+ satisfy it, and no palette is hand-authored here: `palettes/` holds Base24 schemes
61
+ reproduced from a pinned revision, and `src/normalize.ts` is the single place a
62
+ terminal palette becomes an application theme. Adding a theme is a line in
63
+ `src/sources.ts` plus a rebuild.
64
+
65
+ **OKLCH is the representation.** Perceptually uniform lightness is what makes a
66
+ surface ladder buildable by adding fixed steps, a contrast failure repairable by
67
+ moving one axis, and a theme re-hueable without re-deriving its ramp by eye.
68
+
69
+ **Contrast is measured, not assumed.** Nothing enters the catalogue without clearing
70
+ the floors in `src/validate.ts`, and `bun run catalogue:build` fails if a theme
71
+ cannot be repaired within budget. The pipeline caught real defects that a
72
+ hand-authored catalogue would have shipped:
73
+
74
+ - Solarized Light's body text measures 4.28:1 on its own background — under WCAG AA.
75
+ - Tokyo Night's black is 1.17:1 against its canvas, and Gruvbox Light's `white` was
76
+ resolving to a near-black, both from light schemes that invert Base24's greyscale
77
+ ramp.
78
+ - Everforest Light contains no colour above 2.6:1 on its own canvas, so its status
79
+ and accent roles have to be deepened rather than used as published.
80
+
81
+ **Derived colours are derived.** Syntax roles, chart series and status fills are
82
+ functions of the roles a theme does hold (`src/derive.ts`), so two consumers cannot
83
+ disagree about what colour a keyword is.
84
+
85
+ ## Base24 is a bridge, not the schema
86
+
87
+ Base24 is an excellent interchange format and a poor application schema: it has a
88
+ slot for the colour of a deprecated API and nothing that means "the surface one step
89
+ above the card". So Base24 is how values get *in* and how they get *out*:
90
+
91
+ ```ts
92
+ import { toBase24, formatBase24Scheme, parseBase24Scheme } from '@adea-ai/themes'
93
+ import { getBase24Scheme } from '@adea-ai/themes'
94
+
95
+ formatBase24Scheme(toBase24(getTheme('nord')!)) // a Base24 scheme
96
+ getBase24Scheme('nord') // the vendored original, untouched
97
+ ```
98
+
99
+ `toBase24` re-derives Base24's orange and brown slots, because Adea's schema has no
100
+ role for them; `getBase24Scheme` returns the artefact as reproduced, for callers that
101
+ need it byte-for-byte. The mapping is documented in `src/adapters/base24.ts`.
102
+
103
+ ## Adapters
104
+
105
+ | Import | For | Output |
106
+ | --- | --- | --- |
107
+ | `adapters/css` | the application | CSS custom properties in OKLCH |
108
+ | `adapters/tailwind` | the application | a Tailwind v4 `@theme inline` block |
109
+ | `adapters/shadcn` | this org's components | the shadcn vocabulary, bridged from the same source |
110
+ | `adapters/xterm` | shells | xterm.js's hex-only `ITheme` |
111
+ | `adapters/shiki` | code views | a Shiki theme registration |
112
+ | `adapters/base24` | interop | Base24, both directions |
113
+
114
+ The shadcn bridge is worth knowing about before you read the code: Adea's `accent`
115
+ becomes shadcn's **`primary`**, because in shadcn `--primary` is the action colour and
116
+ `--accent` is a hover wash. Mapping it the other way turns every primary button grey.
117
+ The mapping is in `src/adapters/shadcn.ts`.
118
+
119
+ ## Working on it
120
+
121
+ ```sh
122
+ bun install
123
+ bun run verify # typecheck, lint, catalogue freshness, tests, build
124
+ bun run catalogue:build # regenerate src/generated from palettes/ and sources.ts
125
+ bun run catalogue:check # fail if the committed catalogue is stale
126
+ bun run vendor # refresh palettes/ from the pinned upstream revision
127
+ ```
128
+
129
+ The generated catalogue is **committed**, and `catalogue:check` fails when it and its
130
+ inputs disagree. A palette change is therefore a reviewable diff rather than an
131
+ invisible drift.
132
+
133
+ `palettes/` is regenerated by `bun run vendor`, which reproduces Base24 schemes from
134
+ a revision pinned in `src/sources.ts`. To adopt a newer upstream, change
135
+ `CATALOGUE_REVISION`, run `vendor`, then `catalogue:build` and read the diff — the
136
+ build prints every value it repaired and why.
137
+
138
+ ### Adding a theme
139
+
140
+ 1. Add its Base24 scheme to `palettes/` (or let `vendor` fetch it: add the slug to
141
+ `VENDORED_SOURCES` in `src/sources.ts` first).
142
+ 2. Record its family's project, URL and licence in `FAMILY_PROVENANCE`, and its
143
+ entry in `VENDORED_SOURCES` — id, labels, description, appearance, tags.
144
+ 3. Declare `accentSlot` if the family's identity is not in its blue slot. Everforest
145
+ is green, Rosé Pine is iris, Monokai is magenta.
146
+ 4. Add a fidelity assertion to `tests/provenance.test.ts`. The suite fails without
147
+ one — a theme cannot be added without recording where its colours come from.
148
+ 5. `bun run catalogue:build && bun run verify`.
149
+
150
+ If the build reports a role it could not repair within budget, the answer is a
151
+ decision rather than a tweak: either the palette genuinely cannot express that role,
152
+ in which case say so in the entry's description, or the floor is wrong, in which case
153
+ change it in `CONTRAST_FLOORS` and justify it there.
154
+
155
+ ## Licence
156
+
157
+ Apache-2.0. The palettes are not: see [NOTICE](NOTICE) for each project and its terms.
@@ -0,0 +1,117 @@
1
+ /**
2
+ * The Base24 bridge.
3
+ *
4
+ * Base24 is the interchange format this package speaks to the outside world, in
5
+ * both directions. Importing is the normalizer's first step for every theme that
6
+ * is not authored here ({@link "./normalize"}); exporting is how a theme reaches a
7
+ * terminal, a tmux theme, or another tool that has never heard of Adea.
8
+ *
9
+ * ## The slot order is not the ANSI order
10
+ *
11
+ * Base24's `base12`–`base17` are *bright red, bright yellow, bright green, bright
12
+ * cyan, bright blue, bright magenta* — the order Base16 needed to keep its ramps
13
+ * monotonic, not the ANSI order of yellow before green. Reading them positionally
14
+ * as ANSI 1–6 silently swaps green and yellow and blue and cyan, which is the kind
15
+ * of mistake that survives review because the theme still *looks* like itself.
16
+ * {@link BASE24_TO_ANSI} names the mapping explicitly so it cannot be inferred
17
+ * wrongly.
18
+ *
19
+ * ## The two slots with no Adea role
20
+ *
21
+ * `base09` (orange) and `base0F` (brown) have no counterpart in the canonical
22
+ * schema: Adea has no "constant" or "deprecated" role, because a UI does not. On
23
+ * export they are re-derived from `red` and `yellow` by a fixed rotation, and
24
+ * {@link AdeaThemeRecord} carries the vendored schemes separately for callers who
25
+ * need the originals byte-for-byte. Round-tripping is therefore lossless for every
26
+ * role Adea models, and explicitly approximate for the two it does not — rather
27
+ * than silently lossy, which is what an unnamed slot would have been.
28
+ */
29
+ import type { AdeaTheme, AdeaThemeColors } from '../schema';
30
+ import type { Oklch } from '../oklch';
31
+ /** The twenty-four Base24 slots, in the order the specification lists them. */
32
+ export declare const BASE24_SLOTS: readonly ["base00", "base01", "base02", "base03", "base04", "base05", "base06", "base07", "base08", "base09", "base0A", "base0B", "base0C", "base0D", "base0E", "base0F", "base10", "base11", "base12", "base13", "base14", "base15", "base16", "base17"];
33
+ export type Base24Slot = (typeof BASE24_SLOTS)[number];
34
+ /** A Base24 palette. Values are colours in any notation {@link parseColor} accepts. */
35
+ export type Base24Palette = Readonly<Record<Base24Slot, string>>;
36
+ /** A Base24 scheme: the palette plus the metadata the specification defines. */
37
+ export interface Base24Scheme {
38
+ system: 'base24';
39
+ name: string;
40
+ author: string;
41
+ variant: 'dark' | 'light';
42
+ palette: Base24Palette;
43
+ }
44
+ /**
45
+ * What each slot means, in the specification's own terms.
46
+ *
47
+ * Kept as data because the normalizer reads it rather than hard-coding slot names
48
+ * in its logic, and because it is the documentation a reader needs to check that
49
+ * the mapping is right.
50
+ */
51
+ export declare const BASE24_SLOT_MEANING: Readonly<Record<Base24Slot, string>>;
52
+ /**
53
+ * Base24 slot → ANSI role.
54
+ *
55
+ * `black`, `white` and `brightBlack` are absent because Base24 does not name them:
56
+ * the background and foreground slots do double duty. The normalizer decides those
57
+ * three; see its `ANSI_FROM_BASE24` note for why the choice is the one it is.
58
+ */
59
+ export declare const BASE24_TO_ANSI: Readonly<{
60
+ readonly red: "base08";
61
+ readonly yellow: "base0A";
62
+ readonly green: "base0B";
63
+ readonly cyan: "base0C";
64
+ readonly blue: "base0D";
65
+ readonly magenta: "base0E";
66
+ readonly brightRed: "base12";
67
+ readonly brightYellow: "base13";
68
+ readonly brightGreen: "base14";
69
+ readonly brightCyan: "base15";
70
+ readonly brightBlue: "base16";
71
+ readonly brightMagenta: "base17";
72
+ }>;
73
+ /** The inverse of {@link BASE24_TO_ANSI}, for export. */
74
+ export declare const ANSI_TO_BASE24: Readonly<Record<string, Base24Slot>>;
75
+ /**
76
+ * How each semantic role is written back to a Base24 slot on export.
77
+ *
78
+ * The choices are not arbitrary. `base01` receives `black` rather than the
79
+ * background because an ANSI black that equals the background is invisible as
80
+ * foreground text — which is precisely the defect the import side documents. The
81
+ * surface ladder has no Base24 slot at all, so it is deliberately absent here:
82
+ * Base24 cannot express it, and pretending otherwise by packing four rungs into
83
+ * `base01`/`base02` would make the export lie about what it preserves.
84
+ */
85
+ export declare const THEME_TO_BASE24: Readonly<Record<keyof AdeaThemeColors, Base24Slot | undefined>>;
86
+ /** Thrown when a palette is missing a slot or holds an unparseable colour. */
87
+ export declare class Base24ParseError extends Error {
88
+ readonly slot: string;
89
+ constructor(message: string, slot: string);
90
+ }
91
+ /** Parses every slot of a palette into OKLCH, or throws naming the offending slot. */
92
+ export declare function parseBase24Palette(palette: Base24Palette): Record<Base24Slot, Oklch>;
93
+ /**
94
+ * Writes a theme back to Base24.
95
+ *
96
+ * `base09` and `base0F` are synthesised — see this module's header. `base10` and
97
+ * `base11` are the two rungs below `base00`, which is what the specification
98
+ * defines them as and what a terminal needs in order to draw a black that is
99
+ * darker than the background.
100
+ */
101
+ export declare function toBase24(theme: AdeaTheme, options?: {
102
+ author?: string;
103
+ name?: string;
104
+ }): Base24Scheme;
105
+ /** Serialises a scheme to the YAML dialect Base24 schemes are published in. */
106
+ export declare function formatBase24Scheme(scheme: Base24Scheme): string;
107
+ /**
108
+ * Reads the YAML dialect Base24 schemes are published in.
109
+ *
110
+ * Hand-written rather than pulled from a YAML library: the format is a fixed set
111
+ * of scalar keys, the package has no runtime dependencies and no build-time
112
+ * dependencies beyond the TypeScript compiler, and a general parser would accept
113
+ * documents this bridge cannot actually honour. Anything outside the specification
114
+ * is rejected loudly instead of being parsed into a half-scheme.
115
+ */
116
+ export declare function parseBase24Scheme(source: string): Base24Scheme;
117
+ //# sourceMappingURL=base24.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base24.d.ts","sourceRoot":"","sources":["../../src/adapters/base24.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAY,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAGrC,+EAA+E;AAC/E,eAAO,MAAM,YAAY,2PAyBf,CAAA;AAEV,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAEtD,uFAAuF;AACvF,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAA;AAEhE,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,QAAQ,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;IACzB,OAAO,EAAE,aAAa,CAAA;CACvB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAyBnE,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;EAasC,CAAA;AAEjE,yDAAyD;AACzD,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAI/D,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,eAAe,EAAE,UAAU,GAAG,SAAS,CAAC,CAmBxF,CAAA;AAEJ,8EAA8E;AAC9E,qBAAa,gBAAiB,SAAQ,KAAK;IAGvC,QAAQ,CAAC,IAAI,EAAE,MAAM;gBADrB,OAAO,EAAE,MAAM,EACN,IAAI,EAAE,MAAM;CAKxB;AAED,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAcpF;AAcD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,EAChB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/C,YAAY,CAgDd;AAQD,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAU/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAwD9D"}