2019-06-20 12:02:28 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
2020-07-31 12:43:08 +02:00
|
|
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
2019-06-20 12:02:28 +02:00
|
|
|
*****************************************************************************/
|
|
|
|
|
2020-07-31 12:43:08 +02:00
|
|
|
#ifndef QSK_RGB_PALETTE_H
|
|
|
|
#define QSK_RGB_PALETTE_H
|
2017-10-17 17:29:02 +02:00
|
|
|
|
2020-07-31 12:43:08 +02:00
|
|
|
#include "QskGlobal.h"
|
|
|
|
#include <qmetaobject.h>
|
|
|
|
#include <qcolor.h>
|
2017-10-17 17:29:02 +02:00
|
|
|
|
2020-07-31 13:26:22 +02:00
|
|
|
class QskGradientStop;
|
2020-10-23 13:43:28 +02:00
|
|
|
|
2020-07-31 12:43:08 +02:00
|
|
|
class QSK_EXPORT QskRgbPalette
|
2017-10-17 17:29:02 +02:00
|
|
|
{
|
2020-07-31 12:43:08 +02:00
|
|
|
Q_GADGET
|
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
public:
|
2017-10-17 17:29:02 +02:00
|
|
|
enum Weight
|
|
|
|
{
|
|
|
|
W50,
|
|
|
|
W100,
|
|
|
|
W200,
|
|
|
|
W300,
|
|
|
|
W400,
|
|
|
|
W500,
|
|
|
|
W600,
|
|
|
|
W700,
|
|
|
|
W800,
|
|
|
|
W900,
|
|
|
|
|
|
|
|
NumWeights
|
|
|
|
};
|
2020-07-31 12:43:08 +02:00
|
|
|
Q_ENUM( Weight )
|
2017-10-17 17:29:02 +02:00
|
|
|
|
2020-07-31 12:43:08 +02:00
|
|
|
enum Theme
|
2017-10-17 17:29:02 +02:00
|
|
|
{
|
|
|
|
Red,
|
|
|
|
Pink,
|
|
|
|
Purple,
|
|
|
|
DeepPurple,
|
|
|
|
Indigo,
|
|
|
|
Blue,
|
|
|
|
LightBlue,
|
|
|
|
Cyan,
|
|
|
|
Teal,
|
|
|
|
Green,
|
|
|
|
LightGreen,
|
|
|
|
Lime,
|
|
|
|
Yellow,
|
|
|
|
Amber,
|
|
|
|
Orange,
|
|
|
|
DeepOrange,
|
|
|
|
Brown,
|
|
|
|
Grey,
|
|
|
|
BlueGrey,
|
|
|
|
|
2020-07-31 12:43:08 +02:00
|
|
|
NumThemes
|
2017-10-17 17:29:02 +02:00
|
|
|
};
|
2020-07-31 12:43:08 +02:00
|
|
|
Q_ENUM( Theme )
|
2017-10-17 17:29:02 +02:00
|
|
|
|
2020-07-31 16:56:33 +02:00
|
|
|
static QskRgbPalette palette( Theme );
|
|
|
|
|
2020-07-31 12:43:08 +02:00
|
|
|
inline QRgb rgb( Weight weight ) const
|
2017-10-17 17:29:02 +02:00
|
|
|
{
|
2020-07-31 12:43:08 +02:00
|
|
|
if ( weight < 0 || weight >= NumWeights )
|
|
|
|
return 0;
|
|
|
|
|
2017-10-17 17:29:02 +02:00
|
|
|
return m_rgb[ weight ];
|
|
|
|
}
|
|
|
|
|
|
|
|
inline QColor color( Weight weight ) const
|
|
|
|
{
|
|
|
|
return QColor::fromRgba( rgb( weight ) );
|
|
|
|
}
|
|
|
|
|
2020-07-31 13:26:22 +02:00
|
|
|
QVector< QskGradientStop > colorStops( bool discrete = false ) const;
|
|
|
|
|
2020-07-31 16:56:33 +02:00
|
|
|
static QVector< QskGradientStop > colorStops( Theme, bool discrete = false );
|
|
|
|
|
|
|
|
static QVector< QskGradientStop > colorStops(
|
|
|
|
const QVector< QRgb >&, bool discrete = false );
|
2017-10-17 17:29:02 +02:00
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
protected:
|
2020-07-31 12:43:08 +02:00
|
|
|
const QRgb* m_rgb;
|
2017-10-17 17:29:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|