the _lp_color_map will use a scale system

and not a step one
This commit is contained in:
François Schmidts 2013-06-07 12:05:31 +02:00 committed by Olivier Mengué
parent d104b275a1
commit 7b631646a3

View File

@ -1144,30 +1144,30 @@ _lp_battery_color()
_lp_color_map() { _lp_color_map() {
local -i value=$1 local -i value=$1
local -i step=$2 local -i scale=$2
if (( value < step * 5 )); then if (( value < scale / 2 )); then
if (( value < step * 3 )); then if (( value < scale / 10 * 3 )); then
if (( value < step )); then if (( value < scale / 10 )); then
echo -ne "${LP_COLORMAP_0}" echo -ne "${LP_COLORMAP_0}"
elif (( value < step * 2 )); then elif (( value < scale / 10 * 2 )); then
echo -ne "${LP_COLORMAP_1}" echo -ne "${LP_COLORMAP_1}"
else # 40..59 else # 40..59
echo -ne "${LP_COLORMAP_2}" echo -ne "${LP_COLORMAP_2}"
fi fi
elif (( value < step * 4 )); then elif (( value < scale / 10 * 4 )); then
echo -ne "${LP_COLORMAP_3}" echo -ne "${LP_COLORMAP_3}"
else # 80..99 else # 80..99
echo -ne "${LP_COLORMAP_4}" echo -ne "${LP_COLORMAP_4}"
fi fi
elif (( value < step * 8 )); then elif (( value < scale / 10 * 8 )); then
if (( value < step * 6 )); then if (( value < scale / 10 * 6 )); then
echo -ne "${LP_COLORMAP_5}" echo -ne "${LP_COLORMAP_5}"
elif (( value < step * 7 )); then elif (( value < scale / 10 * 7 )); then
echo -ne "${LP_COLORMAP_6}" echo -ne "${LP_COLORMAP_6}"
else else
echo -ne "${LP_COLORMAP_7}" echo -ne "${LP_COLORMAP_7}"
fi fi
elif (( value < step * 9 )) ; then elif (( value < scale / 10 * 9 )) ; then
echo -ne "${LP_COLORMAP_8}" echo -ne "${LP_COLORMAP_8}"
else # (( value >= 180 )) else # (( value >= 180 ))
echo -ne "${LP_COLORMAP_9}" echo -ne "${LP_COLORMAP_9}"
@ -1197,7 +1197,7 @@ _lp_load_color()
local -i load=${tmp:-0}/$_lp_CPUNUM local -i load=${tmp:-0}/$_lp_CPUNUM
if (( load > $LP_LOAD_THRESHOLD )); then if (( load > $LP_LOAD_THRESHOLD )); then
local ret="$(_lp_color_map $load 20)${LP_MARK_LOAD}" local ret="$(_lp_color_map $load 200)${LP_MARK_LOAD}"
if [[ "$LP_PERCENTS_ALWAYS" == 1 ]]; then if [[ "$LP_PERCENTS_ALWAYS" == 1 ]]; then
if $_LP_SHELL_bash; then if $_LP_SHELL_bash; then
@ -1245,7 +1245,7 @@ _lp_temperature() {
temperature="$($_lp_temp_function)" temperature="$($_lp_temp_function)"
if [[ $temperature -ge $LP_TEMP_THRESHOLD ]]; then if [[ $temperature -ge $LP_TEMP_THRESHOLD ]]; then
echo -ne "${LP_MARK_TEMP}$(_lp_color_map $temperature 10)$temperature°${NO_COL}" echo -ne "${LP_MARK_TEMP}$(_lp_color_map $temperature 120)$temperature°${NO_COL}"
fi fi
} }