conversion from Qt::GlobalColor added

This commit is contained in:
Uwe Rathmann 2020-08-15 12:19:44 +02:00
parent 8154bc42f7
commit 65872352e0
2 changed files with 34 additions and 1 deletions

View File

@ -122,3 +122,34 @@ QColor QskRgbValue::interpolated( const QColor& c1, const QColor& c2, qreal rati
else
return qskInterpolatedColor( c1.convertTo( c2.spec() ), c2, ratio );
}
QRgb QskRgbValue::rgb( Qt::GlobalColor color )
{
using namespace QskRgbValue;
static constexpr QRgb rgbValues[] =
{
White, // Qt::color0
Black, // Qt::color1
Black, // Qt::black
White, // Qt::white
Grey, // Qt::darkGray
qRgb( 160, 160, 164 ), // Qt::gray
Silver, // Qt::lightGray
Red, // Qt::red
Lime, // Qt::green
Blue, // Qt::blue
Cyan, // Qt::cyan
Magenta, // Qt::magenta
Yellow, // Qt::yellow
Maroon, // Qt::darkRed
Green, // Qt::darkGreen
Navy, // Qt::darkBlue
Teal, // Qt::darkCyan
Purple, // Qt::darkMagenta
Olive, // Qt::darkYellow
Transparent // Qt::transparent
};
return rgbValues[ color ];
}

View File

@ -56,7 +56,7 @@
RGB( Aquamarine, 0xff7fffd4 ) \
RGB( Maroon, 0xff800000 ) \
RGB( Purple, 0xff800080 ) \
RGB( Olive, 0xff808080 ) \
RGB( Olive, 0xff808000 ) \
RGB( Grey, 0xff808080 ) \
RGB( SkyBlue, 0xff87ceeb ) \
RGB( LightSkyBlue, 0xff87cefa ) \
@ -425,6 +425,7 @@
RGB( BlueGrey800, 0xff37474f ) \
RGB( BlueGrey900, 0xff263238 ) \
\
RGB( Transparent, 0x00000000 ) \
RGB( AlphaMask, 0xff000000 ) \
RGB( ColorMask, 0x00ffffff )
@ -434,6 +435,7 @@ namespace QskRgbValue
QSK_RGB_VALUES
#undef RGB
QSK_EXPORT QRgb rgb( Qt::GlobalColor );
QSK_EXPORT QRgb interpolated( QRgb rgb1, QRgb rgb2, qreal ratio );
QSK_EXPORT QColor interpolated( const QColor& c1, const QColor& c2, qreal ratio );