Files
tinty-wrapper/README.md
T
2026-10-23 11:24:18 +02:00

228 lines
7.0 KiB
Markdown

# tint
A small wrapper around [Tinty](https://github.com/tinted-theming/tinty) that manages light/dark theme pairs and applies the selected theme to Ghostty, Zed, Herdr, OMP, and Conjure.
## Requirements
This setup targets macOS and requires:
- [Homebrew](https://brew.sh/)
- Go 1.26 or newer
- Tinty 0.34 or newer
- [`dark-notify`](https://github.com/cormacrelf/dark-notify) for automatic switching when macOS changes appearance
- `make` from the Xcode Command Line Tools
Install the required tools:
```sh
xcode-select --install
brew tap tinted-theming/tinted
brew install tinty go
brew install cormacrelf/tap/dark-notify
```
Ghostty, Zed, Herdr, OMP, and Conjure are optional consumers. Install only the applications you use.
## Install
From this directory, run:
```sh
make install
```
The installer:
- Builds `~/.local/bin/tint`.
- Installs `config.toml` under `$XDG_CONFIG_HOME/tinted-theming/tinty`, or `~/.config/tinted-theming/tinty` when `XDG_CONFIG_HOME` is unset.
- Copies the versioned `default-state.toml` to the installed `state.toml` only when no state file already exists.
- Creates `~/.config/herdr/config.toml` if needed.
- Runs `tinty sync` to download the configured theme repositories.
- Installs bundled custom schemes into Tinty's data directory.
- Creates and loads a `dark-notify` LaunchAgent for automatic macOS appearance switching.
Add the binary directory to your shell path:
```sh
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
```
Verify the installation:
```sh
which tint
tinty --version
tint
```
## Automatic light/dark switching
`make install` creates and loads `~/Library/LaunchAgents/dev.tinty.dark-notify.plist`. The agent starts at login, restarts if it exits, and invokes `tint light` or `tint dark` whenever macOS changes appearance.
Confirm that the agent is running:
```sh
launchctl print "gui/$(id -u)/dev.tinty.dark-notify"
```
Inspect its output if an application does not update:
```sh
tail -f ~/Library/Logs/dark-notify.log
```
## Application setup
### Ghostty
The Tinty hook writes:
```text
~/.config/ghostty/themes/tinted-theming
```
Select it in the Ghostty configuration:
```text
theme = tinted-theming
```
The hook sends `SIGUSR2` to reload Ghostty after applying a theme.
### Zed
The wrapper writes:
```text
~/.config/zed/themes/tinty-current.json
```
After applying the first theme, select `Tinty Current` in Zed.
### Herdr
The wrapper maintains a generated `[theme.custom]` block in:
```text
~/.config/herdr/config.toml
```
When the `herdr` executable is available, the wrapper also runs `herdr server reload-config`.
### OMP
The wrapper writes:
```text
~/.omp/agent/themes/tinty-current.json
```
Configure OMP to use `tinty-current` where required.
### Conjure
The `apply-apps` flow writes `$XDG_CONFIG_HOME/conjure/theme.json`, falling back to `~/.config/conjure/theme.json` when `XDG_CONFIG_HOME` is unset, empty, or relative. The generated JSON contains the selected scheme's `variant` (`light` or `dark`) and seven opaque colors: `background`, `text`, `secondaryText`, `accent`, `glow`, `keyBackground`, and `error`, using Tinty semantic UI colors with Base16/Base24 or tinted8 palette fallbacks. Conjure uses the variant to match its native window appearance to the palette without an additional user setting.
Opt in by adding this to `conjure/config.toml` in the same configuration directory:
```toml
theme = "tint"
```
The wrapper never changes `config.toml`. Optional entries in its `[colors]` table override generated colors. Only the machine-generated `theme.json` uses JSON; edit the TOML configuration instead. Conjure watches both files and applies changes live, including automatic macOS light/dark switches, without restarting or discarding active tool state. The wrapper does not need to signal or restart Conjure.
## Usage
Show the current pair and available commands:
```sh
tint
```
Select a named pair:
```sh
tint swamp
```
Apply one side of the current pair:
```sh
tint light
tint dark
```
Set both sides:
```sh
tint light:base16-swamp-light dark:base16-swamp-dark
```
Save and favorite a named pair:
```sh
tint pair swamp dark:base16-swamp-dark light:base16-swamp-light
tint favorite swamp
```
Force appearance selection for scripts or troubleshooting:
```sh
TINTY_PAIR_APPEARANCE=light tint swamp
TINTY_PAIR_APPEARANCE=dark tint swamp
```
### Pumpkin
The bundled [`base16-pumpkin`](schemes/base16/pumpkin.yaml) palette comes from the sibling Terebi project. It preserves the player's brown, cream, sand, orange and ember colors and adds the remaining Base16 syntax hues. It is dark-only; keep your existing light theme.
`make install` installs it automatically. To install just the palette and updated wrapper without syncing repositories or reloading the appearance agent:
```sh
make install-schemes
go build -o "$HOME/.local/bin/tint" .
tint favorite base16-pumpkin
tint dark:base16-pumpkin
```
Setting the dark side preserves the light side and applies whichever side matches macOS appearance. Use `tint dark` to apply the saved dark side immediately.
Tinty stores the YAML under `$(tinty config --data-dir-path)/custom-schemes/base16/pumpkin.yaml` and builds the installed app templates when applying it. Both theme validation and app palette lookup support [Tinty's native custom schemes](https://github.com/tinted-theming/tinty/blob/v0.34.0/USAGE.md#use-your-own-schemes), so Ghostty, Zed, Herdr, OMP and Conjure use the normal application flow. List local palettes with `tinty list --custom-schemes`. Reinstalling updates the bundled palette without changing the saved pair or favorites; uninstalling removes the bundled YAML.
## Update
After changing or updating the wrapper source:
```sh
make install
```
Existing `state.toml` content is preserved. Missing state is recreated from `default-state.toml`, including the bundled named pairs and favorites. The source directory's ignored `state.toml` is personal state and is not used by the installer.
## Uninstall
```sh
make uninstall
```
This unloads and removes the LaunchAgent, log, and `tint` binary. It also removes configuration, state, and the empty Herdr configuration only when they were originally created by `make install`; pre-existing user files are preserved. Tinty itself and its shared data remain installed.
## Licensed under GPL-3.0
In plain terms:
- Anyone may use, copy, modify, and sell the software.
- Distributed copies must remain GPL-3.0.
- Modified versions must clearly say they were changed.
- Distributing binaries requires providing the corresponding source code.
- Recipients receive the same rights to modify and redistribute.
- Distributors cannot add restrictions that contradict the GPL.
- Patent rights cannot be used to make the software effectively proprietary.
- Hardware distributors cannot prevent users from installing modified versions.
- The software comes without warranty or liability.
- Private use and private modifications impose no publication requirement.
- Merely using the software over a network does not require publishing changes; that requirement belongs to the AGPL.
For details, see the actual [LICENSE](LICENSE).