mirror of
https://github.com/omacom/omarchy.git
synced 2026-09-28 14:23:08 +08:00
T3 Code reads themes an environment publishes into its state directory, so a generated t3code.json carries the palette the same way claude.json and vscode-theme.json already do, and omarchy-theme-set-t3code republishes it on every theme change for the app to pick up live. The template overrides only the roles a theme actually designs -- terminal and code surfaces, text on canvas, borders, selection -- and leaves muted text, placeholders, and status foregrounds to T3 Code, which contrast-solves them against whatever canvas it is given. Overriding those directly cost readability on light themes: White fell to 1.0:1 on placeholder text. Installing from the menu now routes through omarchy-install-ai-t3-code so a fresh install publishes the current palette and opens wearing it.
35 lines
1.3 KiB
Bash
Executable File
35 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Sync the generated Omarchy theme to T3 Code
|
|
# omarchy:hidden=true
|
|
|
|
set -euo pipefail
|
|
|
|
T3CODE_SOURCE_PATH="$HOME/.local/state/omarchy/current/theme/t3code.json"
|
|
T3CODE_HOME="${T3CODE_HOME:-$HOME/.t3}"
|
|
T3CODE_STATE_DIR="$T3CODE_HOME/userdata"
|
|
# The filename is the theme id T3 Code shows and `t3 theme set` accepts, and
|
|
# it stays stable while the colors change underneath on every theme switch.
|
|
T3CODE_THEME_PATH="$T3CODE_STATE_DIR/themes/omarchy.json"
|
|
|
|
[[ -f $T3CODE_SOURCE_PATH ]] || exit 0
|
|
|
|
# A theme without an accent or a background leaves its placeholder unresolved.
|
|
# Publishing that would only make T3 Code reject the file, so skip instead and
|
|
# leave the previous palette in place.
|
|
if grep -q '{{' "$T3CODE_SOURCE_PATH"; then
|
|
echo "Skipping T3 Code theme: $(basename "$T3CODE_SOURCE_PATH") has unresolved colors." >&2
|
|
exit 0
|
|
fi
|
|
|
|
# Only follow an install that already exists. Creating the directory here would
|
|
# leave a stray T3 Code state dir on machines that do not run it.
|
|
[[ -d $T3CODE_STATE_DIR ]] || exit 0
|
|
|
|
# T3 Code watches this file and retints every connected client on change, so
|
|
# the write has to be atomic: a half-written file would read as invalid.
|
|
mkdir -p "$(dirname "$T3CODE_THEME_PATH")"
|
|
tmp=$(mktemp "$T3CODE_THEME_PATH.XXXXXX")
|
|
cp "$T3CODE_SOURCE_PATH" "$tmp"
|
|
mv "$tmp" "$T3CODE_THEME_PATH"
|