Open History to see the last commit
1# Environment theme
2
3Some desktops publish the palette they are currently wearing so that apps can match it. When the
4machine running your T3 Code server does that, its themes appear in the theme library alongside
5your own, and T3 Code follows them: change the desktop theme and T3 Code retints with it, without
6a restart.
7
8To use one:
9
101. Open **Settings**.
112. Select **Appearance**.
123. Choose the theme published by your environment.
13
14Like every theme, this is a per-client choice: picking it on your desktop does not change what your
15phone or another browser shows.
16
17The machine can also set the environment's theme:
18
19```bash
20t3 theme set nightfall
21```
22
23Web and desktop clients switch to it — immediately when connected, on their next connect
24otherwise — and a fresh client opens with it. Each client applies a set once, so picking a
25different theme in Settings afterwards sticks until the next `t3 theme set`, and running the same
26set again is how you bring clients back. `t3 theme clear` removes the setting without changing
27what anyone currently has, and `t3 theme show` prints the current theme and everything the
28machine publishes. Only the environment you are anchored to publishes themes, so a remote client
29follows the machine it is connected to, not the device it runs on. T3 Code Mobile keeps its own
30appearance settings and does not follow environment themes.
31
32Select **Duplicate** on a published theme's card to keep a copy you can edit. The published theme
33itself cannot be edited or removed, because the environment rewrites it whenever its own theme
34changes. If the machine stops publishing it, the card disappears and clients using it fall back to
35the standard T3 Code look. A theme you saved always wins over a published one with the same id.
36
37When the theme editor is open, its draft stays visible while published themes change.
38Close the editor to show the latest selected theme.
39
40## Publishing themes
41
42A machine publishes themes by writing files into the `themes` directory of the T3 Code state
43directory (`~/.t3/userdata/themes/` by default). The filename is the theme id — `nightfall.json`
44appears as `nightfall` — and stays stable while the machine rewrites the colors underneath, so
45selections and defaults keep pointing at it.
46
47The filename may not be an appearance keyword (`system`, `light`, `dark`) or a built-in theme's
48id — those names already mean something on every client. Two formats are accepted. A theme
49exported from T3 Code (the **Download** button's output) works as-is, so any theme someone shared
50can be dropped in unchanged. Or, for a desktop that only knows
51its own palette, a short seeded form:
52
53```json
54{
55 "name": "Nightfall",
56 "appearance": "dark",
57 "canvas": "#1a1b26",
58 "accent": "#7aa2f7"
59}
60```
61
62`appearance` is `light` or `dark`, and `canvas` and `accent` are hex colors. T3 Code generates the
63rest of the palette from those two, the same way the guided theme editor does, so the result reads
64as a T3 Code theme wearing your desktop's colors rather than a transplant of another app's.
65
66A machine that knows a role better than a derivation can guess — its terminal palette, its
67semantic colors — can publish that role directly under `colors`, layered over the generated
68palette:
69
70```json
71{
72 "name": "Nightfall",
73 "appearance": "dark",
74 "canvas": "#1a1b26",
75 "accent": "#7aa2f7",
76 "colors": {
77 "terminalSelection": "#292e42",
78 "error": "#f7768e"
79 }
80}
81```
82
83Any of the roles shown in the theme editor's advanced view can be published this way; roles left
84out keep their generated value. A role this version of T3 Code does not know is ignored rather
85than rejected, so publishing a role added by a newer release is safe. An `id` inside the file is
86ignored — the filename decides.
87
88A theme with no usable colors is not listed on that client.
89
90Write each file atomically — write a temporary file beside it and rename — so T3 Code never reads
91a half-written theme. An unreadable or invalid file is simply not published; the machine's other
92themes are unaffected.