herdr-gentle-shell 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +299 -96
- package/README.md +83 -23
- package/docs/theme-sync.md +634 -181
- package/extensions/gentle-herdr-state.ts +145 -51
- package/extensions/herdr-theme-sync.ts +184 -159
- package/lib/customize-panel.js +602 -308
- package/lib/herdr-theme-apply.js +361 -0
- package/lib/herdr-theme-config.js +1133 -0
- package/lib/theme-projection.js +48 -9
- package/package.json +1 -1
package/lib/theme-projection.js
CHANGED
|
@@ -13,7 +13,37 @@
|
|
|
13
13
|
// tokens (sidebar_bg, panel_bg, active_row_bg, selection_bg, surface*) keep
|
|
14
14
|
// their base-theme values because Pi has no equivalent surface concept: a Pi
|
|
15
15
|
// theme names foregrounds and accents, not panel backgrounds, so inventing one
|
|
16
|
-
// here would put colours on screen that the user never chose.
|
|
16
|
+
// here would put colours on screen that the user never chose. The one exception
|
|
17
|
+
// is the fixed Gentleman.Dots table below, which is not invented here: it is the
|
|
18
|
+
// palette the user's own Herdr profiles already use.
|
|
19
|
+
//
|
|
20
|
+
// Looked up by Pi theme NAME, exactly like the reference table: the Gentle themes
|
|
21
|
+
// are the only ones whose surface colours we know.
|
|
22
|
+
//
|
|
23
|
+
// Ported from gentle-herdr lib/herdr-theme-projection.ts
|
|
24
|
+
// (https://github.com/MarsSall/gentle-herdr, MIT License, Copyright (c) MarsSall).
|
|
25
|
+
const DOTS_CUTE = Object.freeze({
|
|
26
|
+
panel_bg: '#000000',
|
|
27
|
+
surface0: '#241822',
|
|
28
|
+
surface1: '#342230',
|
|
29
|
+
surface_dim: '#20161E',
|
|
30
|
+
overlay0: '#B99AA9',
|
|
31
|
+
});
|
|
32
|
+
// Sexy shares Cute's surfaces and only differs in the accent: Herdr draws
|
|
33
|
+
// unfocused session names with subtext0 and branches with overlay0 (mauve when
|
|
34
|
+
// focused), so Sexy gets fuchsia names, grayish pink branches and a wine row.
|
|
35
|
+
const DOTS_SEXY = Object.freeze({
|
|
36
|
+
...DOTS_CUTE,
|
|
37
|
+
subtext0: '#FF4F9A',
|
|
38
|
+
mauve: '#B99AA9',
|
|
39
|
+
active_row_bg: '#2E0F1F',
|
|
40
|
+
selection_bg: '#2E0F1F',
|
|
41
|
+
});
|
|
42
|
+
const DOTS_FIXED = Object.freeze({
|
|
43
|
+
'Gentleman-Cute': DOTS_CUTE,
|
|
44
|
+
'Gentleman-Sexy': DOTS_SEXY,
|
|
45
|
+
Gentle: Object.freeze({ panel_bg: '#06080f' }),
|
|
46
|
+
});
|
|
17
47
|
|
|
18
48
|
const HERDR_BASE_THEME = 'one-dark';
|
|
19
49
|
|
|
@@ -58,7 +88,10 @@ const HERDR_TOKEN_ORDER = Object.freeze([
|
|
|
58
88
|
'surface_dim',
|
|
59
89
|
]);
|
|
60
90
|
|
|
61
|
-
// The only Pi theme tokens this projection reads
|
|
91
|
+
// The only Pi theme tokens this projection reads, and exactly the reference's
|
|
92
|
+
// eight: working/done status and notification colours (yellow, teal, blue,
|
|
93
|
+
// peach) stay with Herdr's native base theme, because mapping them here
|
|
94
|
+
// recoloured statuses the user never asked to repaint. `subtext0` and `overlay0`
|
|
62
95
|
// share Pi's `muted`: a single Pi role paints two Herdr surfaces, and the
|
|
63
96
|
// emitted pair follows the source, so they are never half-applied.
|
|
64
97
|
const HERDR_ROLE_SOURCES = Object.freeze({
|
|
@@ -66,9 +99,6 @@ const HERDR_ROLE_SOURCES = Object.freeze({
|
|
|
66
99
|
text: 'text',
|
|
67
100
|
red: 'error',
|
|
68
101
|
green: 'success',
|
|
69
|
-
yellow: 'warning',
|
|
70
|
-
blue: 'mdLink',
|
|
71
|
-
teal: 'syntaxType',
|
|
72
102
|
subtext0: 'muted',
|
|
73
103
|
overlay0: 'muted',
|
|
74
104
|
overlay1: 'thinkingText',
|
|
@@ -112,10 +142,18 @@ function requireColors(input) {
|
|
|
112
142
|
// The Herdr custom table for a Pi palette, in Herdr token order. A token whose
|
|
113
143
|
// source is not a concrete hex is omitted rather than defaulted: an empty string
|
|
114
144
|
// means "terminal default" in Pi, which has no hex spelling, and a guessed one
|
|
115
|
-
// would repaint the sidebar in a colour nobody picked.
|
|
116
|
-
|
|
145
|
+
// would repaint the sidebar in a colour nobody picked. A DOTS_FIXED value for the
|
|
146
|
+
// same token wins over the mapped one: those surfaces are known from the user's
|
|
147
|
+
// Herdr profiles, while the mapped colour is an approximation of them.
|
|
148
|
+
function customTokens(name, colors) {
|
|
149
|
+
const themeName = normalizeThemeName(name);
|
|
150
|
+
const fixed = Object.hasOwn(DOTS_FIXED, themeName ?? '') ? DOTS_FIXED[themeName] : {};
|
|
117
151
|
const custom = {};
|
|
118
152
|
for (const token of HERDR_TOKEN_ORDER) {
|
|
153
|
+
if (Object.hasOwn(fixed, token)) {
|
|
154
|
+
custom[token] = fixed[token].toLowerCase();
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
119
157
|
const source = HERDR_ROLE_SOURCES[token];
|
|
120
158
|
if (source === undefined) continue;
|
|
121
159
|
const hex = colors[source];
|
|
@@ -127,7 +165,7 @@ function customTokens(colors) {
|
|
|
127
165
|
|
|
128
166
|
function projectPalette(input) {
|
|
129
167
|
const colors = requireColors(input);
|
|
130
|
-
const custom = customTokens(colors);
|
|
168
|
+
const custom = customTokens(input.name, colors);
|
|
131
169
|
const theme = { name: HERDR_BASE_THEME };
|
|
132
170
|
// An empty custom table is omitted, not written empty: Herdr would still treat
|
|
133
171
|
// the block as an override, and S7 wants an untouched palette to stay one.
|
|
@@ -141,7 +179,7 @@ function projectPalette(input) {
|
|
|
141
179
|
function paletteFingerprint(input) {
|
|
142
180
|
const colors = requireColors(input);
|
|
143
181
|
const name = normalizeThemeName(input.name);
|
|
144
|
-
const pairs = Object.entries(customTokens(colors)).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
182
|
+
const pairs = Object.entries(customTokens(name, colors)).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
145
183
|
return JSON.stringify([name, pairs]);
|
|
146
184
|
}
|
|
147
185
|
|
|
@@ -150,6 +188,7 @@ module.exports = {
|
|
|
150
188
|
HERDR_BASE_THEMES,
|
|
151
189
|
HERDR_TOKEN_ORDER,
|
|
152
190
|
HERDR_ROLE_SOURCES,
|
|
191
|
+
DOTS_FIXED,
|
|
153
192
|
THEME_OFF_LABEL,
|
|
154
193
|
isConcreteHex,
|
|
155
194
|
projectPalette,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "herdr-gentle-shell",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Pi package for Herdr sidebar states: the Pi extension sidecar that publishes session facts as Herdr pane-metadata tokens, the optional Moshi notification channel, and the Pi-side helpers the Herdr Gentle Shell plugin drives.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|