Setup seamless, automatic, and persistent colorscheme switching in tmux

that follows colorsync
This commit is contained in:
Martin Larsson 2025-07-24 00:40:02 +02:00
parent 9c5a1479b7
commit 68b8a7b608
4 changed files with 62 additions and 8 deletions

View file

@ -1,7 +1,31 @@
format_for_tmux() {
fg="#1F2430"
bg="#73D0FF"
THEME=$(colorsync get)
default() {
bg="#95E6CB"
fg="#000000"
text_col="#BFBDB6"
}
case "$THEME" in
ayudark)
default
;;
ayumirage)
bg="#95E6CB"
fg="#101521"
text_col="#CCCAC2"
;;
ayulight)
bg="#4CBF99"
fg="#F3F4F5"
text_col="#5C6166"
;;
*)
default
;;
esac
format_for_tmux() {
echo $1 | gawk -v bg="$bg" -v fg="$fg" -v text_col="$text_col" '{printf("#[default]#[fg="bg"]#[default]#[bg="bg", fg="fg", bold]%s #[default]#[fg="bg"]#[default]#[fg="text_col"] %s", substr($0, 1, 1), substr($0, 2))}'
}