Skins: Unify lightness enum
This commit is contained in:
parent
b84593a6f4
commit
98158b2a4b
@ -946,8 +946,8 @@ void Editor::setupVirtualKeyboard()
|
||||
setPadding( Q::Panel, 8 );
|
||||
}
|
||||
|
||||
QskFluent2Theme::QskFluent2Theme( Theme lightness )
|
||||
: QskFluent2Theme( lightness,
|
||||
QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme )
|
||||
: QskFluent2Theme( colorScheme,
|
||||
{ // default Fluent accent colors:
|
||||
0xff98ecfe,
|
||||
0xff60ccfe,
|
||||
@ -960,10 +960,10 @@ QskFluent2Theme::QskFluent2Theme( Theme lightness )
|
||||
{
|
||||
}
|
||||
|
||||
QskFluent2Theme::QskFluent2Theme( Theme theme,
|
||||
QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme,
|
||||
const std::array< QRgb, NumAccentColors >& accentColors )
|
||||
{
|
||||
if( theme == Light )
|
||||
if( colorScheme == QskSkin::Light )
|
||||
{
|
||||
// Fill color:
|
||||
|
||||
@ -1065,7 +1065,7 @@ QskFluent2Theme::QskFluent2Theme( Theme theme,
|
||||
// ### should actually be drawn twice with different values:
|
||||
shadow.dialog = { QskShadowMetrics( 0, 21, QPointF( 0, 2 ) ), rgbGray( 0, 0.1474 ) };
|
||||
}
|
||||
else if( theme == Dark )
|
||||
else if( colorScheme == QskSkin::Dark )
|
||||
{
|
||||
// Fill color:
|
||||
|
||||
|
@ -18,12 +18,6 @@
|
||||
class QSK_FLUENT2_EXPORT QskFluent2Theme
|
||||
{
|
||||
public:
|
||||
enum Theme
|
||||
{
|
||||
Light,
|
||||
Dark
|
||||
};
|
||||
|
||||
enum AccentColors
|
||||
{
|
||||
AccentLight3,
|
||||
@ -37,8 +31,8 @@ class QSK_FLUENT2_EXPORT QskFluent2Theme
|
||||
NumAccentColors
|
||||
};
|
||||
|
||||
QskFluent2Theme( Theme );
|
||||
QskFluent2Theme( Theme, const std::array< QRgb, NumAccentColors >& );
|
||||
QskFluent2Theme( QskSkin::ColorScheme );
|
||||
QskFluent2Theme( QskSkin::ColorScheme, const std::array< QRgb, NumAccentColors >& );
|
||||
|
||||
typedef std::array< QRgb, 2 > BorderGradient;
|
||||
|
||||
|
@ -27,12 +27,12 @@ QskSkin* QskFluent2SkinFactory::createSkin( const QString& skinName )
|
||||
{
|
||||
if ( QString::compare( skinName, fluent2LightSkinName, Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
QskFluent2Theme theme( QskFluent2Theme::Light );
|
||||
QskFluent2Theme theme( QskSkin::Light );
|
||||
return new QskFluent2Skin( theme );
|
||||
}
|
||||
else if ( QString::compare( skinName, fluent2DarkSkinName, Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
QskFluent2Theme theme( QskFluent2Theme::Dark );
|
||||
QskFluent2Theme theme( QskSkin::Dark );
|
||||
return new QskFluent2Skin( theme );
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,7 @@
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QStyleHints>
|
||||
|
||||
static const int qskDuration = 150;
|
||||
|
||||
@ -1192,8 +1193,8 @@ void Editor::setupSubWindow()
|
||||
|
||||
}
|
||||
|
||||
QskMaterial3Theme::QskMaterial3Theme( Lightness lightness )
|
||||
: QskMaterial3Theme( lightness,
|
||||
QskMaterial3Theme::QskMaterial3Theme( QskSkin::ColorScheme colorScheme )
|
||||
: QskMaterial3Theme( colorScheme,
|
||||
{ // default Material colors:
|
||||
0xff6750A4,
|
||||
0xff625B71,
|
||||
@ -1205,11 +1206,11 @@ QskMaterial3Theme::QskMaterial3Theme( Lightness lightness )
|
||||
{
|
||||
}
|
||||
|
||||
QskMaterial3Theme::QskMaterial3Theme( Lightness lightness,
|
||||
QskMaterial3Theme::QskMaterial3Theme( QskSkin::ColorScheme colorScheme,
|
||||
std::array< QskHctColor, NumPaletteTypes > palettes )
|
||||
: m_palettes( palettes )
|
||||
{
|
||||
if ( lightness == Light )
|
||||
if ( colorScheme == QskSkin::Light )
|
||||
{
|
||||
primary = m_palettes[ Primary ].toned( 40 ).rgb();
|
||||
onPrimary = m_palettes[ Primary ].toned( 100 ).rgb();
|
||||
@ -1243,7 +1244,7 @@ QskMaterial3Theme::QskMaterial3Theme( Lightness lightness,
|
||||
|
||||
shadow = m_palettes[ Neutral ].toned( 0 ).rgb();
|
||||
}
|
||||
else if ( lightness == Dark )
|
||||
else if ( colorScheme == QskSkin::Dark )
|
||||
{
|
||||
primary = m_palettes[ Primary ].toned( 80 ).rgb();
|
||||
onPrimary = m_palettes[ Primary ].toned( 20 ).rgb();
|
||||
|
@ -18,12 +18,6 @@
|
||||
class QSK_MATERIAL3_EXPORT QskMaterial3Theme
|
||||
{
|
||||
public:
|
||||
enum Lightness
|
||||
{
|
||||
Light,
|
||||
Dark
|
||||
};
|
||||
|
||||
enum PaletteType
|
||||
{
|
||||
Primary,
|
||||
@ -36,8 +30,8 @@ class QSK_MATERIAL3_EXPORT QskMaterial3Theme
|
||||
NumPaletteTypes
|
||||
};
|
||||
|
||||
QskMaterial3Theme( Lightness );
|
||||
QskMaterial3Theme( Lightness, std::array< QskHctColor, NumPaletteTypes > );
|
||||
QskMaterial3Theme( QskSkin::ColorScheme );
|
||||
QskMaterial3Theme( QskSkin::ColorScheme, std::array< QskHctColor, NumPaletteTypes > );
|
||||
|
||||
QRgb primary;
|
||||
QRgb primary8; // ### rename to primaryHovered or so?
|
||||
|
@ -27,12 +27,12 @@ QskSkin* QskMaterial3SkinFactory::createSkin( const QString& skinName )
|
||||
{
|
||||
if ( QString::compare( skinName, materialLightSkinName, Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
QskMaterial3Theme theme( QskMaterial3Theme::Light );
|
||||
QskMaterial3Theme theme( QskSkin::Light );
|
||||
return new QskMaterial3Skin( theme );
|
||||
}
|
||||
else if ( QString::compare( skinName, materialDarkSkinName, Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
QskMaterial3Theme theme( QskMaterial3Theme::Dark );
|
||||
QskMaterial3Theme theme( QskSkin::Dark );
|
||||
return new QskMaterial3Skin( theme );
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,16 @@ class QSK_EXPORT QskSkin : public QObject
|
||||
|
||||
Q_ENUM( SkinFontRole )
|
||||
|
||||
#if 1
|
||||
// Use Qt::ColorScheme once minimum version is Qt 6.5
|
||||
enum ColorScheme
|
||||
{
|
||||
Unknown,
|
||||
Light,
|
||||
Dark
|
||||
};
|
||||
#endif
|
||||
|
||||
QskSkin( QObject* parent = nullptr );
|
||||
~QskSkin() override;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user