Search code examples
gradientconky

Is there a way to make `membar` and `fs_bar` have gradient colors in conky?


Is there a way to make membar and fs_bar have gradient colors in conky? What I exactly need GREEN when the usage is low, YELLOW when mid-range, and RED when there is high usage of memory and disk space.


Solution

  • The only way to do this easily is to write some code in lua. If you search you should find many examples, such as this. It uses a highly parameterable bargraph function.

    For something simple in pure conky, you can use if_match to change the colour of the entire bar, eg:

    ${if_match $memperc>60} ${color red} $else ${color green} $endif ${membar 20,100}
    

    You would need to nest another test for a yellow stage, and remove the spaces above if you do not want them to appear in the output.