1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:07:35 +00:00

SystemMonitor: Define graphs by ColorRole, not by Color

Currently, graphs are defined in terms of graph color. This means that
when the system palette is changed, the old colors are still used. We
switch to storing the color roles and looking up the palette colors on
paint events. We also define the graph line background color as the
graph color at half-transparency.
This commit is contained in:
Sahan Fernando 2021-02-14 20:04:38 +11:00 committed by Andreas Kling
parent 6ee499aeb0
commit ca731e2cdd
3 changed files with 21 additions and 16 deletions

View file

@ -28,6 +28,7 @@
#include <AK/CircularQueue.h>
#include <LibGUI/Frame.h>
#include <LibGfx/SystemTheme.h>
class GraphWidget final : public GUI::Frame {
C_OBJECT(GraphWidget)
@ -40,8 +41,7 @@ public:
void add_value(Vector<int, 1>&&);
struct ValueFormat {
Color line_color { Color::Transparent };
Color background_color { Color::Transparent };
Gfx::ColorRole graph_color_role { Gfx::ColorRole::Base };
Color text_shadow_color { Color::Transparent };
Function<String(int)> text_formatter;
};