Ensure tmux coloring is updated live too

This commit is contained in:
David Heinemeier Hansson
2026-05-23 13:46:27 +02:00
parent e65246642d
commit 4030bb4813
4 changed files with 168 additions and 12 deletions
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
# omarchy:summary=Print OSC sequences for an Omarchy color theme
# omarchy:hidden=true
theme="${1:-$HOME/.config/omarchy/current/theme/colors.toml}"
[[ -f $theme ]] || exit 0
awk -F= '
function clean(value) {
gsub(/^[[:space:]]+|[[:space:]]+$/, "", value)
if (value ~ /^"/) {
sub(/^"/, "", value)
sub(/".*$/, "", value)
}
return value
}
{
key = $1
gsub(/^[[:space:]]+|[[:space:]]+$/, "", key)
value = clean($2)
}
key == "foreground" { printf "\033]10;%s\007", value }
key == "background" { printf "\033]11;%s\007", value }
key == "cursor" { printf "\033]12;%s\007", value }
key == "selection_background" { printf "\033]17;%s\007", value }
key == "selection_foreground" { printf "\033]19;%s\007", value }
key ~ /^color[0-9]+$/ {
color_index = substr(key, 6) + 0
if (color_index >= 0 && color_index <= 15) {
printf "\033]4;%d;%s\007", color_index, value
}
}
' "$theme"