Feat: interpolate colors (#208)

* feat: interpolate theme colors

* doc: add interpolated colors to readme
This commit is contained in:
vdbe 2024-05-11 16:23:05 +00:00 committed by GitHub
parent 2292669be3
commit 6ba7a72925
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 56 additions and 15 deletions

View file

@ -0,0 +1,11 @@
#!/bin/sh
do_color_interpolation() {
local all_interpolated="$1"
for ((i=0; i<${#color_interpolation[@]}; i++)); do
all_interpolated=${all_interpolated//${color_interpolation[$i]}/${color_values[$i]}}
done
echo "$all_interpolated"
}

View file

@ -22,6 +22,27 @@ get_tmux_option() {
fi
}
get_interpolated_tmux_option() {
local option value default
option="$1"
default="$2"
value=$(tmux show-option -gqv "$option")
if [ -n "$value" ]
then
if [ "$value" = "null" ]
then
echo ""
else
do_color_interpolation "$value"
fi
else
echo "$default"
fi
}
set() {
local option=$1
local value=$2