Feat: interpolate colors (#208)
* feat: interpolate theme colors * doc: add interpolated colors to readme
This commit is contained in:
parent
2292669be3
commit
6ba7a72925
4 changed files with 56 additions and 15 deletions
11
utils/interpolate_utils.sh
Normal file
11
utils/interpolate_utils.sh
Normal 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"
|
||||
}
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue