tabby-hypr-palette 0.1.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.
- package/README.md +15 -0
- package/index.js +37 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,8 +51,23 @@ then restart Tabby. Settings → Hypr palette.
|
|
|
51
51
|
| Accent selection | on | with its opacity (0.3) |
|
|
52
52
|
| Accent on the active tab | on | a line under the active tab |
|
|
53
53
|
| Glass menu border | on | with its opacity (0.6) |
|
|
54
|
+
| Accent colour for the prompt | 99 | this colour of the 256-colour palette becomes the accent (0 for none) |
|
|
54
55
|
| Monitor | where the window is | or a fixed one, numbered left to right |
|
|
55
56
|
|
|
57
|
+
## The accent in the shell prompt
|
|
58
|
+
|
|
59
|
+
The accent is also put in one colour of the 256-colour palette, 99 by
|
|
60
|
+
default, so the shell can draw with it: whatever uses colour 99 takes the
|
|
61
|
+
wallpaper's accent, per monitor, and changes with it (lines already drawn
|
|
62
|
+
too). For the Powerlevel10k ruler, in `.zshrc`:
|
|
63
|
+
|
|
64
|
+
```zsh
|
|
65
|
+
typeset -g POWERLEVEL9K_RULER_FOREGROUND=99
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Pick a colour nothing else uses (the prompt's segments use 0-15, its greys
|
|
69
|
+
232-255).
|
|
70
|
+
|
|
56
71
|
## How it works
|
|
57
72
|
|
|
58
73
|
`gsettings get` reads Hypr Paper's keys (through its schema in the
|
package/index.js
CHANGED
|
@@ -44,6 +44,9 @@ const DEFAULTS = {
|
|
|
44
44
|
glassMenuOpacity: 0.6,
|
|
45
45
|
// 'auto' (the monitor the window is on) or a monitor index, left to right
|
|
46
46
|
monitor: 'auto',
|
|
47
|
+
// a colour of the 256-colour palette (16-255) set to the accent, for the
|
|
48
|
+
// shell prompt (POWERLEVEL9K_RULER_FOREGROUND=99…); 0 for none
|
|
49
|
+
accentSlot: 99,
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
const COLOR_NAMES = [
|
|
@@ -158,6 +161,21 @@ function angleDiff (a, b) {
|
|
|
158
161
|
return d
|
|
159
162
|
}
|
|
160
163
|
|
|
164
|
+
/** xterm's default colours 16-255: the 6×6×6 cube and the 24 greys */
|
|
165
|
+
function defaultExtendedAnsi () {
|
|
166
|
+
const out = []
|
|
167
|
+
const level = v => (v === 0 ? 0 : 55 + v * 40)
|
|
168
|
+
for (let i = 16; i < 232; i++) {
|
|
169
|
+
const n = i - 16
|
|
170
|
+
out.push(toHex({ r: level(Math.floor(n / 36)), g: level(Math.floor(n / 6) % 6), b: level(n % 6) }))
|
|
171
|
+
}
|
|
172
|
+
for (let i = 0; i < 24; i++) {
|
|
173
|
+
const v = 8 + i * 10
|
|
174
|
+
out.push(toHex({ r: v, g: v, b: v }))
|
|
175
|
+
}
|
|
176
|
+
return out
|
|
177
|
+
}
|
|
178
|
+
|
|
161
179
|
/* ---------------------------------------------------------------- Palette */
|
|
162
180
|
|
|
163
181
|
const MAX_HUE_REACH = (60 / 180) * Math.PI
|
|
@@ -269,6 +287,14 @@ function buildTheme (base, wall, s, schemeBackground) {
|
|
|
269
287
|
if (accent && s.selection) {
|
|
270
288
|
theme.selectionBackground = toRgba(accent, clamp(num(s.selectionOpacity, 0.3), 0, 1))
|
|
271
289
|
}
|
|
290
|
+
const slot = Math.round(num(s.accentSlot, 0))
|
|
291
|
+
if (accent && slot >= 16 && slot <= 255) {
|
|
292
|
+
const ext = Array.isArray(base.extendedAnsi) && base.extendedAnsi.length === 240
|
|
293
|
+
? [...base.extendedAnsi]
|
|
294
|
+
: defaultExtendedAnsi()
|
|
295
|
+
ext[slot - 16] = toHex(accent)
|
|
296
|
+
theme.extendedAnsi = ext
|
|
297
|
+
}
|
|
272
298
|
return theme
|
|
273
299
|
}
|
|
274
300
|
|
|
@@ -562,7 +588,7 @@ class HyprPaletteService {
|
|
|
562
588
|
|
|
563
589
|
const exportsForTests = {
|
|
564
590
|
parseColor, toHex, toOklch, fromOklch, contrast, tintAnsi, buildTheme,
|
|
565
|
-
pickForDisplay, DEFAULTS, COLOR_NAMES,
|
|
591
|
+
pickForDisplay, defaultExtendedAnsi, DEFAULTS, COLOR_NAMES,
|
|
566
592
|
}
|
|
567
593
|
|
|
568
594
|
if (!NgModule) {
|
|
@@ -672,6 +698,14 @@ if (!NgModule) {
|
|
|
672
698
|
</div>
|
|
673
699
|
</div>
|
|
674
700
|
|
|
701
|
+
<div class="form-line">
|
|
702
|
+
<div class="header">
|
|
703
|
+
<div class="title">Accent colour for the prompt</div>
|
|
704
|
+
<div class="description">This colour of the 256-colour palette (16-255) becomes the accent, so the shell can use it: POWERLEVEL9K_RULER_FOREGROUND={{ s.accentSlot || 99 }} in .zshrc. 0 for none</div>
|
|
705
|
+
</div>
|
|
706
|
+
<input type="number" min="0" max="255" class="form-control thp-number" [(ngModel)]="s.accentSlot" (ngModelChange)="save()">
|
|
707
|
+
</div>
|
|
708
|
+
|
|
675
709
|
<div class="form-line">
|
|
676
710
|
<div class="header">
|
|
677
711
|
<div class="title">Monitor</div>
|
|
@@ -706,6 +740,7 @@ if (!NgModule) {
|
|
|
706
740
|
s.strength = clamp(num(s.strength, DEFAULTS.strength), 0, 1)
|
|
707
741
|
s.selectionOpacity = clamp(num(s.selectionOpacity, DEFAULTS.selectionOpacity), 0, 1)
|
|
708
742
|
s.glassMenuOpacity = clamp(num(s.glassMenuOpacity, DEFAULTS.glassMenuOpacity), 0, 1)
|
|
743
|
+
s.accentSlot = Math.round(clamp(num(s.accentSlot, DEFAULTS.accentSlot), 0, 255))
|
|
709
744
|
this.config.save()
|
|
710
745
|
this.service.refresh()
|
|
711
746
|
}
|
|
@@ -721,6 +756,7 @@ if (!NgModule) {
|
|
|
721
756
|
.thp-intro { opacity: 0.8; }
|
|
722
757
|
.thp-status { opacity: 0.6; font-style: italic; }
|
|
723
758
|
.thp-select { width: auto; min-width: 180px; }
|
|
759
|
+
.thp-number { width: 90px; }
|
|
724
760
|
.thp-range { display: flex; align-items: center; gap: 12px; min-width: 260px; }
|
|
725
761
|
.thp-range input { flex: 1; }
|
|
726
762
|
.thp-range span { min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tabby-hypr-palette",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Tabby's terminal colours follow the wallpaper chosen with Hypr Paper (GNOME): ANSI colours tinted towards its palette, accent cursor, selection and tabs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tabby-plugin",
|