Simplify theme palette tokens

This commit is contained in:
Ryan Hughes
2026-06-11 02:08:02 -04:00
parent 4b2a15b6ea
commit 221fb296fc
48 changed files with 1053 additions and 590 deletions
+20 -10
View File
@@ -54,21 +54,31 @@ theme_osc_sequences() {
theme_color() {
local key="$1"
local fallback="${2:-}"
awk -F= -v key="$key" -v fallback="$fallback" '
function clean(raw) {
gsub(/^[[:space:]]+|[[:space:]]+$/, "", raw)
if (raw ~ /^"/) {
sub(/^"/, "", raw)
sub(/".*$/, "", raw)
}
return raw
}
awk -F= -v key="$key" '
{
field = $1
gsub(/^[[:space:]]+|[[:space:]]+$/, "", field)
if (field == key) {
value = $2
gsub(/^[[:space:]]+|[[:space:]]+$/, "", value)
if (value ~ /^"/) {
sub(/^"/, "", value)
sub(/".*$/, "", value)
}
print value
print clean($2)
found = 1
exit
}
if (fallback != "" && field == fallback) fallback_value = clean($2)
}
END {
if (!found && fallback_value != "") print fallback_value
}
' "$COLORS_TOML"
}
@@ -78,8 +88,8 @@ sync_tmux_window_style() {
[[ -f $COLORS_TOML ]] || return
foreground=$(theme_color foreground)
background=$(theme_color background)
foreground=$(theme_color foreground fg)
background=$(theme_color background bg)
[[ -n $foreground && -n $background ]] || return