|
|
|
@ -2,10 +2,6 @@ |
|
|
|
|
# helpers for tmux status line scripts |
|
|
|
|
|
|
|
|
|
function get_bgcolor_gradient_red_to_cyan() { |
|
|
|
|
local curval=${1:-0} |
|
|
|
|
local maxval=${2:-100} |
|
|
|
|
local maxindex=$(( ${#colors[@]} - 1 )) |
|
|
|
|
local index=$(( (curval * maxindex) / maxval )) |
|
|
|
|
local -a colors |
|
|
|
|
colors=( |
|
|
|
|
196 # red |
|
|
|
@ -16,6 +12,10 @@ function get_bgcolor_gradient_red_to_cyan() { |
|
|
|
|
047 048 049 050 # green-cyans |
|
|
|
|
051 # cyan |
|
|
|
|
) |
|
|
|
|
local curval=${1:-0} |
|
|
|
|
local maxval=${2:-100} |
|
|
|
|
local maxindex=$(( ${#colors[@]} - 1 )) |
|
|
|
|
local index=$(( (curval * maxindex) / maxval )) |
|
|
|
|
if [[ $index -gt $maxindex ]]; then |
|
|
|
|
index=$maxindex |
|
|
|
|
elif [[ $index -lt 0 ]]; then |
|
|
|
|