mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
statistics: add color-related functions
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>
This commit is contained in:
parent
93ba2219ee
commit
7339dc28ae
3 changed files with 56 additions and 0 deletions
18
stats/statscolors.h
Normal file
18
stats/statscolors.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
// Color constants for the various series
|
||||
#ifndef STATSCOLORS_H
|
||||
#define STATSCOLORS_H
|
||||
|
||||
#include <QColor>
|
||||
|
||||
inline const QColor fillColor(0x44, 0x76, 0xaa);
|
||||
inline const QColor borderColor(0x66, 0xb2, 0xff);
|
||||
inline const QColor highlightedColor(Qt::yellow);
|
||||
inline const QColor highlightedBorderColor(0xaa, 0xaa, 0x22);
|
||||
inline const QColor darkLabelColor(Qt::black);
|
||||
inline const QColor lightLabelColor(Qt::white);
|
||||
|
||||
QColor binColor(int bin, int numBins);
|
||||
QColor labelColor(int bin, size_t numBins);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue