aristocratos / bashtop

Linux/OSX/FreeBSD resource monitor
Apache License 2.0
10.79k stars 552 forks source link

[REQUEST] turn around gradient for process list in black on white #151

Closed ulph0 closed 4 years ago

ulph0 commented 4 years ago

hi, when theme[main_bg] is black and theme[main_fg] is white, this means highlighting is a lighter colour so in the process list the processes on top are lighter. that is correct. but since i use black on white terminals i have to turn it around, because in this case a darker font is 'highlighted'. But when for example i use #ff for theme[main_bg] and #cc for theme[main_fg], the fonts of the processes are still lighter. of course now the top processes should be in #ff and the ones at the bottom in #cc. i didn't find a way to do that in the theme file. regards.

aristocratos commented 4 years ago

I've added a check if the foreground color red, green and blue values adds up to less than (255*3)/2 to assume dark text and invert the gradient in the processes box. Will be in next update.

ulph0 commented 4 years ago

cool! thank you!

ulph0 commented 4 years ago

hi, i upgraded to bashtop 0.9.20 but it still prints the top processes lighter than the lower ones when i have a white background. here the default theme: image

aristocratos commented 4 years ago

Well yeah, the gradient is based on the text color. Even if it was based on the background color and you have transparent background set in the theme (which the default has) it would be impossible to know what color your background is.

You have to use a light theme or manually set the text color to a darker color in a copy of the default theme.

I've added a check if the foreground color red, green and blue values adds up to less than (255*3)/2 to assume dark text and invert the gradient in the processes box.

ulph0 commented 4 years ago

i copied the "whiteout" theme and changed it because the default theme is not as a file in the themes folder. when i switch theme[main_fg] to black, i have no gradient at all. what do i have to change? please see my settings below. okay, maybe you couldn't autodetect the background color if set to terminal default, but what when there is s.th. in theme[main_bg]? eg. white?


# Main background, empty for terminal default, need to be empty if you want transparent background
theme[main_bg]=""

# Main text color
theme[main_fg]="#00"

# Title color for boxes
theme[title]="#10"

# Higlight color for keyboard shortcuts
theme[hi_fg]="#284d75"

# Background color of selected item in processes box
theme[selected_bg]="#15283d"

# Foreground color of selected item in processes box
theme[selected_fg]="#ff"

# Color of inactive/disabled text
theme[inactive_fg]="#dd"

# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
theme[proc_misc]="#00"

# Cpu box outline color
theme[cpu_box]="#1a361e"

# Memory/disks box outline color
theme[mem_box]="#3d3c14"

# Net up/down box outline color
theme[net_box]="#1a1742"

# Processes box outline color
theme[proc_box]="#3b1515"
aristocratos commented 4 years ago

Yup, my mistake. Didn't account for value being zero in the calculations, will be fixed in next update. Again :)

ulph0 commented 4 years ago

mhm i even see no gradient if i set theme[main_fg]="#11"

aristocratos commented 4 years ago

Yeah, the calculation right now is (value-(value/6)/height_of_box) which becomes to small to be noticeable on lower values, the new calculations to fix it is (value-255-(value-255/6)/height_of_box) which reverses it when the values are below 255*3/2 and keeps the normal calculation when values are above.

aristocratos commented 4 years ago

Fixed in v0.9.21

ulph0 commented 4 years ago

thanks! works & looks pretty well now!