subsurface/stats/statscolors.h
Dirk Hohndel 7339dc28ae 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>
2021-01-01 21:10:10 +01:00

18 lines
541 B
C

// 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