Move the various font objects the the StatsTheme structure to enable
different font weights for different themes.
For the dark theme, switch to a bold font, because the thin white
font was barely visible.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Create the themes only when needed (singleton pattern). If
the themes should do more than colors, such as for example
fonts, it is not clear whether that can be done before main()
runs. By creating the themes on demand, the Qt UI should
be initialized in the constructors of the themes.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Some of the colors (like the bin colors or the highlight yellow) stay
the same, others are adjusted to fit better with a dark background.
This is far from perfect, but it's ok-ish.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
To enable rudimentary theming, collect all colors in a new
theme class. The class has to be passed down to the various
items.
In general the items save a reference to the them in the
constructor. Alternatively, they might also just query
the StatsView everytime they need to access a color.
For now, it's hard the say what is preferred: a reference
per item or a function call per invokation?
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Add a source file and a header file, which implement the color
scheme used by the statistics module.
Besides a few color constants, the centerpiece is a
function that returns the color representing a bin and
an appropriate label color. It picks a roughly equi-distant
set of colors out of an already balanced set of 50 candidate
colors. And it also picks white as text color when adding a
label to a segment with a dark color.
The color list was created using a tool by Gregor Aisch that
is available on GitHub as https://github.com/gka/palettes to
create multi-hued, multi-stop color scales that are safe for
color blind people.
This commit contains code from three authors.
Dirk (main author): adaptive color scheme.
Willem: Colors of single-bin charts and lines.
Berthold: Infrastructure.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>