Skip to content

Adds the option of dark mode colours to the graphs

agurk requested to merge agurk/gnome-power-manager:dark_mode into master

These changes give two options for the graph colours - the original and ones more suitable for dark themes. This is auto selected, or can be set through a dconf setting.

The changes themselves are quite straightforward:

  • Extracts all the graph colours into guints that become properties of EggGraphWidgetPrivate
  • Creates an extra property ("dark-mode") to switch between dark & regular colours. Dark colours are for the most part just 255 - light_value
  • Adds an extra setting info-graph-colors with the options: auto, dark, light
  • For auto detecting it takes one of the widgets and decide it's dark if the summed rgb value is > 1.5f. I have no idea if this is the correct way to do so, but I couldn't find any way to get properties about the theme

I've tested it on my machine and all seems to work ok. It won't redraw in the new colours until the graph type is changed as I couldn't find an obvious way to listen for things like theme changes.

Screenshot_from_2020-04-23_18-39-10

Merge request reports