FelixKratz / SketchyBar

A highly customizable macOS status bar replacement
https://felixkratz.github.io/SketchyBar/
GNU General Public License v3.0
5.64k stars 86 forks source link

multi-color graphs #589

Open incanus opened 1 month ago

incanus commented 1 month ago

I searched and didn't see a history of discussion about this feature, but I would be interested in the ability to plot values of varying color (fill, at least) for graphs. For example, graphing CPU a certain color, but then yellow when >80% and red when >90%.

Has this been looked into at all? Just wondering as I might take a crack at it and submit a PR if there is interest.

incanus commented 1 month ago

Ok, looking into the source, I can see that this is non-trivial, but would be doable. The first-pass approach would be:

I might still give it a shot, but just wanted to summarize for anyone else thinking about it. And totally understandable @FelixKratz if this is out of scope & you want to close the issue.

incanus commented 1 month ago

Alternatively, another way to tackle this could be the ability to set one or more threshold/color combinations, then instead of storing the color for a data point, it could be drawn based on meeting thresholds instead.

FelixKratz commented 1 month ago

I think from the code point-of-view this is doable, I however wonder what a proper syntax for this would look like?

incanus commented 1 month ago

I hadn’t yet checked for support of optional arguments, but for direct color I imagined it would just be:

sketchybar push <name> <data point> <optional point-specific color>

For the idea of thresholds, the syntax does get messier. Maybe an added property syntax like this?

sketchybar —set <name> graph.fill_color=0xffffcccc graph.fill_threshold=90:0xffff000000:80:0xffffff00

(or 0.9 or whatever makes the most sense for range)