qskinny/src/common/QskRgbPalette.h

86 lines
1.5 KiB
C
Raw Normal View History

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
2020-07-31 12:43:08 +02:00
#include "QskGlobal.h"
#include <qmetaobject.h>
#include <qcolor.h>
2020-07-31 13:26:22 +02:00
class QskGradientStop;
template< typename T > class QVector;
2020-07-31 12:43:08 +02:00
class QSK_EXPORT QskRgbPalette
{
2020-07-31 12:43:08 +02:00
Q_GADGET
2018-08-03 08:15:28 +02:00
public:
enum Weight
{
W50,
W100,
W200,
W300,
W400,
W500,
W600,
W700,
W800,
W900,
NumWeights
};
2020-07-31 12:43:08 +02:00
Q_ENUM( Weight )
2020-07-31 12:43:08 +02:00
enum Theme
{
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
};
2020-07-31 12:43:08 +02:00
Q_ENUM( Theme )
2020-07-31 12:43:08 +02:00
inline QRgb rgb( Weight weight ) const
{
2020-07-31 12:43:08 +02:00
if ( weight < 0 || weight >= NumWeights )
return 0;
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 12:43:08 +02:00
static QskRgbPalette palette( Theme );
2018-08-03 08:15:28 +02:00
protected:
2020-07-31 12:43:08 +02:00
const QRgb* m_rgb;
};
#endif