Skip to content

Commit 3096032

Browse files
committed
Fixed incorrect value calculation for reversed proc gradient
1 parent 900cdc0 commit 3096032

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

bashtop

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3221,7 +3221,7 @@ draw_processes() { #? Draw processes and values to screen
32213221
local reverse_string reverse_pos order_left="───────────┤" filter_string current_num detail_location det_no_add com_fg pg_arrow_up_fg pg_arrow_down_fg p_height=$((height-3))
32223222
local pid=0 pid_graph pid_step_r pid_step_g pid_step_b pid_add_r pid_add_g pid_add_b bg_add bg_step proc_start up_fg down_fg page_up_fg page_down_fg this_box=processes
32233223
local d_width=${box[details_width]} d_height=${box[details_height]} d_line=${box[details_line]} d_col=${box[details_col]}
3224-
local detail_graph_width=$((d_width/3+2)) detail_graph_height=$((d_height-1)) kill_fg det_mod fg_add_r fg_add_g fg_add_b fg_inv
3224+
local detail_graph_width=$((d_width/3+2)) detail_graph_height=$((d_height-1)) kill_fg det_mod fg_add_r fg_add_g fg_add_b
32253225
local right_width=$((d_width-detail_graph_width-2))
32263226
local right_col=$((d_col+detail_graph_width+4))
32273227
local -a pid_rgb=(${theme[proc_misc]}) fg_rgb=(${theme[main_fg_dec]})
@@ -3230,14 +3230,23 @@ draw_processes() { #? Draw processes and values to screen
32303230
if [[ $argument == "now" ]]; then skip_process_draw=1; fi
32313231

32323232
if [[ $proc_gradient == true ]]; then
3233-
if ((fg_r+fg_g+fg_b<(255*3)/2)); then fg_inv=1; fi
3234-
fg_add_r="${fg_inv:+-}$(( (fg_r-(fg_r/6) )/height))"
3235-
fg_add_g="${fg_inv:+-}$(( (fg_g-(fg_g/6) )/height))"
3236-
fg_add_b="${fg_inv:+-}$(( (fg_b-(fg_b/6) )/height))"
3237-
3238-
pid_add_r="${fg_inv:+-}$(( (pid_r-(pid_r/6) )/height))"
3239-
pid_add_g="${fg_inv:+-}$(( (pid_g-(pid_g/6) )/height))"
3240-
pid_add_b="${fg_inv:+-}$(( (pid_b-(pid_b/6) )/height))"
3233+
if ((fg_r+fg_g+fg_b<(255*3)/2)); then
3234+
fg_add_r="$(( (fg_r-255-((fg_r-255)/6) )/height))"
3235+
fg_add_g="$(( (fg_g-255-((fg_g-255)/6) )/height))"
3236+
fg_add_b="$(( (fg_b-255-((fg_b-255)/6) )/height))"
3237+
3238+
pid_add_r="$(( (pid_r-255-((pid_r-255)/6) )/height))"
3239+
pid_add_g="$(( (pid_g-255-((pid_g-255)/6) )/height))"
3240+
pid_add_b="$(( (pid_b-255-((pid_b-255)/6) )/height))"
3241+
else
3242+
fg_add_r="$(( (fg_r-(fg_r/6) )/height))"
3243+
fg_add_g="$(( (fg_g-(fg_g/6) )/height))"
3244+
fg_add_b="$(( (fg_b-(fg_b/6) )/height))"
3245+
3246+
pid_add_r="$(( (pid_r-(pid_r/6) )/height))"
3247+
pid_add_g="$(( (pid_g-(pid_g/6) )/height))"
3248+
pid_add_b="$(( (pid_b-(pid_b/6) )/height))"
3249+
fi
32413250
fi
32423251

32433252
unset proc_out

0 commit comments

Comments
 (0)