_lp_color_map: use dichotomy to more evenly distribute cost
This commit is contained in:
parent
b50970f634
commit
43511f6f15
14
liquidprompt
14
liquidprompt
@ -1129,22 +1129,28 @@ _lp_battery_color()
|
|||||||
_lp_color_map() {
|
_lp_color_map() {
|
||||||
local -i load
|
local -i load
|
||||||
load=$1
|
load=$1
|
||||||
|
if (( load < 100 )); then
|
||||||
|
if (( load < 60 )); then
|
||||||
if (( load < 20 )); then
|
if (( load < 20 )); then
|
||||||
echo -ne "${LP_COLORMAP_0}"
|
echo -ne "${LP_COLORMAP_0}"
|
||||||
elif (( load < 40 )); then
|
elif (( load < 40 )); then
|
||||||
echo -ne "${LP_COLORMAP_1}"
|
echo -ne "${LP_COLORMAP_1}"
|
||||||
elif (( load < 60 )); then
|
else # 40..59
|
||||||
echo -ne "${LP_COLORMAP_2}"
|
echo -ne "${LP_COLORMAP_2}"
|
||||||
|
fi
|
||||||
elif (( load < 80 )); then
|
elif (( load < 80 )); then
|
||||||
echo -ne "${LP_COLORMAP_3}"
|
echo -ne "${LP_COLORMAP_3}"
|
||||||
elif (( load < 100 )); then
|
else # 80..99
|
||||||
echo -ne "${LP_COLORMAP_4}"
|
echo -ne "${LP_COLORMAP_4}"
|
||||||
elif (( load < 120 )); then
|
fi
|
||||||
|
elif (( load < 160 )); then
|
||||||
|
if (( load < 120 )); then
|
||||||
echo -ne "${LP_COLORMAP_5}"
|
echo -ne "${LP_COLORMAP_5}"
|
||||||
elif (( load < 140 )); then
|
elif (( load < 140 )); then
|
||||||
echo -ne "${LP_COLORMAP_6}"
|
echo -ne "${LP_COLORMAP_6}"
|
||||||
elif (( load < 160 )); then
|
else
|
||||||
echo -ne "${LP_COLORMAP_7}"
|
echo -ne "${LP_COLORMAP_7}"
|
||||||
|
fi
|
||||||
elif (( load < 180 )) ; then
|
elif (( load < 180 )) ; then
|
||||||
echo -ne "${LP_COLORMAP_8}"
|
echo -ne "${LP_COLORMAP_8}"
|
||||||
else # (( load >= 180 ))
|
else # (( load >= 180 ))
|
||||||
|
Loading…
Reference in New Issue
Block a user