@kecan0406/ttheme 1.0.4 → 1.0.31

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 CHANGED
@@ -18,6 +18,49 @@ Two things separate this from the usual color-scheme dump:
18
18
  - **Colors switch at runtime, not just at startup.** Tabs get different palettes
19
19
  in the same window, and any tab can be repainted at any time.
20
20
 
21
+ ## Terminal support
22
+
23
+ Nothing is emulated — a terminal that cannot express something simply does not
24
+ get it.
25
+
26
+ | Feature | Ghostty | iTerm2 | kitty | Alacritty | WezTerm | Windows Terminal | Warp | Terminal.app | Other |
27
+ |---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
28
+ | **Setup with `init`** | ![Done][done] | ![Done][done] | ![Done][done] | ![Done][done] | ![Done][done] | ![Done][done] | ![Done][done] | ![No][no] | ![No][no] |
29
+ | **Palette files** | ![Done][done] | ![Done][done] | ![Done][done] | ![Done][done] | ![Done][done] | ![Done][done] | ![Done][done] | ![No][no] | ![No][no] |
30
+ | **Runtime repaint** | ![Done][done] | ![Done][done] | ![Done][done] | ![Done][done] | ![Done][done] | ![Done][done] | ![No][no] | ![Done][done] | ![Partial][partial] |
31
+ | **Font** | ![Done][done] | ![No][no] | ![Done][done] | ![Done][done] | ![Done][done] | ![No][no] | ![No][no] | ![No][no] | ![No][no] |
32
+ | **Shader** | ![Done][done] | ![No][no] | ![No][no] | ![No][no] | ![No][no] | ![No][no] | ![No][no] | ![No][no] | ![No][no] |
33
+ | **Background pictures** | ![Done][done] | ![Done][done] | ![No][no] | ![No][no] | ![Partial][partial] | ![No][no] | ![No][no] | ![No][no] | ![No][no] |
34
+
35
+ - **Setup with `init`** — iTerm2 is offered on macOS only, Windows Terminal
36
+ from WSL (or a native Windows zsh), where init writes a settings fragment on
37
+ the Windows side. Warp gets its themes, and the default palette through its
38
+ `settings.toml` (the Warp builds that have one).
39
+ - **Palette files** — iTerm2 gets one dynamic profile per palette, plus
40
+ `.itermcolors` in the archive; Windows Terminal gets one fragment carrying
41
+ every installed scheme.
42
+ - **Runtime repaint** — Ghostty and kitty through native adapters, the rest
43
+ through OSC escape sequences, per pane in WezTerm and Windows Terminal.
44
+ Terminal.app takes every OSC color but no OSC reset, so ttheme reads its
45
+ colors when the shell starts and puts them back itself. Warp answers OSC
46
+ color queries but paints one theme app-wide and never the background an OSC
47
+ sets, so the shell layer stays off there and `ttheme <palette>` points you at
48
+ `ttheme default <palette>`, which puts the palette on every Warp window; any other terminal that speaks OSC 4/10/11 (foot, Konsole,
49
+ VTE-based terminals…) gets repainting and nothing else.
50
+ - **Font** — family and size everywhere it is marked; Ghostty also maps
51
+ codepoints to fonts. iTerm2 keeps the font of your own profile, Windows
52
+ Terminal and Warp the one you set in them.
53
+ - **Background pictures** — `find`, `ttheme image` and `preview`'s live
54
+ backdrop. Ghostty shows one picture app-wide, following the focused tab;
55
+ iTerm2 (3.7 or newer) shows one per tab. WezTerm shows the picture of the
56
+ active tab per window and switches it as `preview` moves, but has no
57
+ in-terminal preview or tuning — find and tune from Ghostty or iTerm2. Cut-outs
58
+ and baked crops need macOS.
59
+
60
+ [done]: https://img.shields.io/badge/Done-2ea44f?style=flat-square
61
+ [partial]: https://img.shields.io/badge/Partial-e3b341?style=flat-square
62
+ [no]: https://img.shields.io/badge/Not%20supported-d0d7de?style=flat-square
63
+
21
64
  ## Palettes
22
65
 
23
66
  | Group | Palettes |
@@ -57,7 +100,7 @@ came from — `ttheme` prints it, and it is in the theme's TOML.
57
100
 
58
101
  ## Install
59
102
 
60
- **Ghostty, kitty, Alacritty or iTerm2** — one command, no clone:
103
+ **Ghostty, kitty, Alacritty, WezTerm, iTerm2, Windows Terminal or Warp** — one command, no clone:
61
104
 
62
105
  ```sh
63
106
  npx @kecan0406/ttheme@latest init
@@ -80,14 +123,25 @@ init makes it iTerm2's default profile, so new tabs and windows open wearing the
80
123
  palette and its picture from their first frame and follow `ttheme default` from
81
124
  then on. iTerm2 reads its default profile only when it starts, so quit and
82
125
  reopen it once after init. The profile it replaces stays the parent of every
83
- ttheme profile, so your font and keys carry over, and `keep` gives it back. It ends with a receipt, paints the first palette onto the tab you
126
+ ttheme profile, so your font and keys carry over, and `keep` gives it back.
127
+ WezTerm's config is Lua, so init puts a two-line block that runs
128
+ `~/.config/ttheme/wezterm.lua` just before your config's `return config` (or
129
+ writes a small `wezterm.lua` when there is none); WezTerm reloads it by itself.
130
+ Windows Terminal gets a fragment,
131
+ `%LOCALAPPDATA%\Microsoft\Windows Terminal\Fragments\ttheme\ttheme.json`,
132
+ with every installed scheme and the default palette on the profile init ran in —
133
+ `settings.json` is never edited, only touched so the terminal reloads. Warp gets
134
+ a theme per palette, `~/.warp/themes/ttheme-<palette>.yaml`, and the default
135
+ palette as the one `theme` key of `[appearance.themes]` in `~/.warp/settings.toml`
136
+ — Warp applies it within a few seconds, and `keep` puts back the theme you had.
137
+ It ends with a receipt, paints the first palette onto the tab you
84
138
  ran it in (not under `keep`) and lists what to do next (`exec zsh` for the
85
139
  `ttheme` command here, a terminal restart for new tabs).
86
140
  Running it again updates in place; `--yes` skips every prompt and installs no
87
141
  palettes — `ttheme browse` opens the full catalog any time, to add or drop
88
142
  single palettes.
89
143
 
90
- **WezTerm, or any of them by hand** — one archive per terminal in the
144
+ **Any of them by hand** — one archive per terminal in the
91
145
  [latest release](https://github.com/kecan0406/ttheme/releases/latest):
92
146
 
93
147
  ```sh
@@ -111,6 +165,15 @@ cp wezterm/colors/miku.toml ~/.config/wezterm/colors/
111
165
 
112
166
  # iTerm2 — open a .itermcolors to add it to Settings > Profiles > Colors presets
113
167
  curl -L $REL/ttheme-iterm2.tar.gz | tar xz
168
+
169
+ # windows terminal — every scheme in one fragment
170
+ curl -L $REL/ttheme-windows-terminal.tar.gz | tar xz
171
+ # copy windows-terminal/ttheme.json into
172
+ # %LOCALAPPDATA%\Microsoft\Windows Terminal\Fragments\ttheme\
173
+
174
+ # warp
175
+ curl -L $REL/ttheme-warp.tar.gz | tar xz
176
+ cp warp/themes/ttheme-miku.yaml ~/.warp/themes/
114
177
  ```
115
178
 
116
179
  The kitty, Alacritty and WezTerm archives also carry a `config/` file per theme
@@ -449,24 +512,18 @@ writes anything.
449
512
  Installed palettes are listed in `~/.config/ttheme/installed.json`, and the
450
513
  catalog is cached in `~/.config/ttheme/catalog.json`.
451
514
 
452
- ## What each terminal can actually do
453
-
454
- Nothing is emulated — a terminal that cannot express something simply does not
455
- get it.
456
-
457
- | | palette file | runtime switching | font | shader |
458
- |---|---|---|---|---|
459
- | **Ghostty** | ✅ | ✅ native adapter | ✅ incl. per-codepoint map | ✅ |
460
- | **kitty** | ✅ | ✅ native adapter | family + size | ✗ |
461
- | **WezTerm** | ✅ | OSC — per window, never per pane | family + size | ✗ |
462
- | **Alacritty** | ✅ | OSC only (no runtime color API exists) | family + size | ✗ |
463
- | **iTerm2** | ✅ a profile per palette | OSC | profile-only | ✗ |
464
- | anything else | — | OSC, if it speaks it | — | ✗ |
515
+ ## Terminal notes
465
516
 
466
517
  Ghostty is the only terminal here with GLSL shaders, and the only one with
467
518
  per-codepoint font mapping — which is why the Hangul→D2Coding rule survives only
468
519
  in its build.
469
520
 
521
+ WezTerm keeps an OSC-set palette per pane, but a picture belongs to the window:
522
+ the Lua module ttheme runs follows the active pane's `ttheme_shown` user var,
523
+ which the shell layer sets whenever the tab's palette changes, and reads the
524
+ picture from `backgrounds/<palette>.conf` itself — so a picture installed or
525
+ tuned from Ghostty or iTerm2 reaches WezTerm within a second.
526
+
470
527
  iTerm2 reads the colors an OSC sets as Display P3 — its default color space — so
471
528
  its profiles and `.itermcolors` files are written in P3 too: a tab opened on a
472
529
  `ttheme · <palette>` profile and a tab repainted to that palette land on the
@@ -500,11 +557,20 @@ never in a theme file. `[font]` and `[ghostty]` are inherited from
500
557
  `themes/_defaults.toml` unless the theme overrides them. Then:
501
558
 
502
559
  ```sh
503
- mise run build # regenerates dist/ for all five terminals — fails on bad contrast
560
+ mise run build # regenerates dist/ for every terminal — fails on bad contrast
504
561
  mise run build --only kitty # just one terminal's subtree
505
562
  mise run test
563
+ mise run compat # the terminal compatibility cases, in each installed terminal
506
564
  ```
507
565
 
566
+ `mise run compat` opens each installed terminal behind your windows on a
567
+ throwaway home (`mise run sandbox`), runs the cases in `tests/compat/cases.zsh`
568
+ inside it — adapter detection, OSC set/query/reset, what the window really
569
+ paints (read off a screenshot), `ttheme <palette>` and its restore, cell size,
570
+ kitty graphics, synchronized output and focus reporting — and compares them
571
+ with `tests/compat/expect.tsv`: a case that used to pass and fails is a
572
+ regression and fails the run, and `--update` records what was measured.
573
+
508
574
  All one hundred and eight currently pass unwaived — `kyubey` runs tightest at
509
575
  4.28:1 where accents need 3:1: it is the one light palette, so every accent has
510
576
  to darken enough to hold against a near-white background. If a palette genuinely