using a struct instead of std::array
This commit is contained in:
parent
b441e29ef4
commit
9f9fafe9ef
|
@ -48,6 +48,7 @@
|
||||||
#include <QskBoxBorderMetrics.h>
|
#include <QskBoxBorderMetrics.h>
|
||||||
#include <QskBoxShapeMetrics.h>
|
#include <QskBoxShapeMetrics.h>
|
||||||
#include <QskMargins.h>
|
#include <QskMargins.h>
|
||||||
|
#include <QskHctColor.h>
|
||||||
#include <QskRgbValue.h>
|
#include <QskRgbValue.h>
|
||||||
|
|
||||||
#include <QskNamespace.h>
|
#include <QskNamespace.h>
|
||||||
|
@ -1264,93 +1265,129 @@ void Editor::setupSubWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
QskMaterial3Theme::QskMaterial3Theme( QskSkin::ColorScheme colorScheme )
|
QskMaterial3Theme::QskMaterial3Theme( QskSkin::ColorScheme colorScheme )
|
||||||
: QskMaterial3Theme( colorScheme,
|
: QskMaterial3Theme( colorScheme, BaseColors() )
|
||||||
{ // default Material colors:
|
|
||||||
0xff6750A4,
|
|
||||||
0xff625B71,
|
|
||||||
0xff7D5260,
|
|
||||||
0xffB3261E,
|
|
||||||
0xff605D62,
|
|
||||||
0xff605D66,
|
|
||||||
} )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QskMaterial3Theme::QskMaterial3Theme( QskSkin::ColorScheme colorScheme,
|
QskMaterial3Theme::QskMaterial3Theme( QskSkin::ColorScheme colorScheme,
|
||||||
std::array< QskHctColor, NumPaletteTypes > palettes )
|
const BaseColors& baseColors )
|
||||||
: m_palettes( palettes )
|
|
||||||
{
|
{
|
||||||
if ( colorScheme == QskSkin::LightScheme )
|
if ( colorScheme == QskSkin::LightScheme )
|
||||||
{
|
{
|
||||||
primary = m_palettes[ Primary ].toned( 40 ).rgb();
|
{
|
||||||
onPrimary = m_palettes[ Primary ].toned( 100 ).rgb();
|
const QskHctColor color( baseColors.primary );
|
||||||
primaryContainer = m_palettes[ Primary ].toned( 90 ).rgb();
|
|
||||||
onPrimaryContainer = m_palettes[ Primary ].toned( 10 ).rgb();
|
|
||||||
|
|
||||||
secondary = m_palettes[ Secondary ].toned( 40 ).rgb();
|
primary = color.toned( 40 ).rgb();
|
||||||
onSecondary = m_palettes[ Secondary ].toned( 100 ).rgb();
|
onPrimary = color.toned( 100 ).rgb();
|
||||||
secondaryContainer = m_palettes[ Secondary ].toned( 90 ).rgb();
|
primaryContainer = color.toned( 90 ).rgb();
|
||||||
onSecondaryContainer = m_palettes[ Secondary ].toned( 10 ).rgb();
|
onPrimaryContainer = color.toned( 10 ).rgb();
|
||||||
|
}
|
||||||
|
|
||||||
tertiary = m_palettes[ Tertiary ].toned( 40 ).rgb();
|
{
|
||||||
onTertiary = m_palettes[ Tertiary ].toned( 100 ).rgb();
|
const QskHctColor color( baseColors.secondary );
|
||||||
tertiaryContainer = m_palettes[ Tertiary ].toned( 90 ).rgb();
|
|
||||||
onTertiaryContainer = m_palettes[ Tertiary ].toned( 10 ).rgb();
|
|
||||||
|
|
||||||
error = m_palettes[ Error ].toned( 40 ).rgb();
|
secondary = color.toned( 40 ).rgb();
|
||||||
onError = m_palettes[ Error ].toned( 100 ).rgb();
|
onSecondary = color.toned( 100 ).rgb();
|
||||||
errorContainer = m_palettes[ Error ].toned( 90 ).rgb();
|
secondaryContainer = color.toned( 90 ).rgb();
|
||||||
onErrorContainer = m_palettes[ Error ].toned( 10 ).rgb();
|
onSecondaryContainer = color.toned( 10 ).rgb();
|
||||||
|
}
|
||||||
|
|
||||||
background = m_palettes[ Neutral ].toned( 99 ).rgb();
|
{
|
||||||
onBackground = m_palettes[ Neutral ].toned( 10 ).rgb();
|
const QskHctColor color( baseColors.tertiary );
|
||||||
surface = m_palettes[ Neutral ].toned( 99 ).rgb();
|
|
||||||
onSurface = m_palettes[ Neutral ].toned( 10 ).rgb();
|
|
||||||
|
|
||||||
surfaceVariant = m_palettes[ NeutralVariant ].toned( 90 ).rgb();
|
tertiary = color.toned( 40 ).rgb();
|
||||||
onSurfaceVariant = m_palettes[ NeutralVariant ].toned( 30 ).rgb();
|
onTertiary = color.toned( 100 ).rgb();
|
||||||
outline = m_palettes[ NeutralVariant ].toned( 50 ).rgb();
|
tertiaryContainer = color.toned( 90 ).rgb();
|
||||||
outlineVariant = m_palettes[ NeutralVariant ].toned( 80 ).rgb();
|
onTertiaryContainer = color.toned( 10 ).rgb();
|
||||||
|
}
|
||||||
|
|
||||||
surfaceContainerHighest = m_palettes[ NeutralVariant ].toned( 90 ).rgb();
|
{
|
||||||
|
const QskHctColor color( baseColors.error );
|
||||||
|
|
||||||
|
error = color.toned( 40 ).rgb();
|
||||||
|
onError = color.toned( 100 ).rgb();
|
||||||
|
errorContainer = color.toned( 90 ).rgb();
|
||||||
|
onErrorContainer = color.toned( 10 ).rgb();
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const QskHctColor color( baseColors.neutral );
|
||||||
|
|
||||||
|
background = color.toned( 99 ).rgb();
|
||||||
|
onBackground = color.toned( 10 ).rgb();
|
||||||
|
surface = color.toned( 99 ).rgb();
|
||||||
|
onSurface = color.toned( 10 ).rgb();
|
||||||
|
shadow = color.toned( 0 ).rgb();
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const QskHctColor color( baseColors.neutralVariant );
|
||||||
|
|
||||||
|
surfaceVariant = color.toned( 90 ).rgb();
|
||||||
|
onSurfaceVariant = color.toned( 30 ).rgb();
|
||||||
|
outline = color.toned( 50 ).rgb();
|
||||||
|
outlineVariant = color.toned( 80 ).rgb();
|
||||||
|
surfaceContainerHighest = color.toned( 90 ).rgb();
|
||||||
|
}
|
||||||
|
|
||||||
shadow = m_palettes[ Neutral ].toned( 0 ).rgb();
|
|
||||||
}
|
}
|
||||||
else if ( colorScheme == QskSkin::DarkScheme )
|
else if ( colorScheme == QskSkin::DarkScheme )
|
||||||
{
|
{
|
||||||
primary = m_palettes[ Primary ].toned( 80 ).rgb();
|
{
|
||||||
onPrimary = m_palettes[ Primary ].toned( 20 ).rgb();
|
const QskHctColor color( baseColors.primary );
|
||||||
primaryContainer = m_palettes[ Primary ].toned( 30 ).rgb();
|
|
||||||
onPrimaryContainer = m_palettes[ Primary ].toned( 90 ).rgb();
|
|
||||||
|
|
||||||
secondary = m_palettes[ Secondary ].toned( 80 ).rgb();
|
primary = color.toned( 80 ).rgb();
|
||||||
onSecondary = m_palettes[ Secondary ].toned( 20 ).rgb();
|
onPrimary = color.toned( 20 ).rgb();
|
||||||
secondaryContainer = m_palettes[ Secondary ].toned( 30 ).rgb();
|
primaryContainer = color.toned( 30 ).rgb();
|
||||||
onSecondaryContainer = m_palettes[ Secondary ].toned( 90 ).rgb();
|
onPrimaryContainer = color.toned( 90 ).rgb();
|
||||||
|
}
|
||||||
|
|
||||||
tertiary = m_palettes[ Tertiary ].toned( 80 ).rgb();
|
{
|
||||||
onTertiary = m_palettes[ Tertiary ].toned( 20 ).rgb();
|
const QskHctColor color( baseColors.secondary );
|
||||||
tertiaryContainer = m_palettes[ Tertiary ].toned( 30 ).rgb();
|
|
||||||
onTertiaryContainer = m_palettes[ Tertiary ].toned( 90 ).rgb();
|
|
||||||
|
|
||||||
error = m_palettes[ Error ].toned( 80 ).rgb();
|
secondary = color.toned( 80 ).rgb();
|
||||||
onError = m_palettes[ Error ].toned( 20 ).rgb();
|
onSecondary = color.toned( 20 ).rgb();
|
||||||
errorContainer = m_palettes[ Error ].toned( 30 ).rgb();
|
secondaryContainer = color.toned( 30 ).rgb();
|
||||||
onErrorContainer = m_palettes[ Error ].toned( 90 ).rgb();
|
onSecondaryContainer = color.toned( 90 ).rgb();
|
||||||
|
}
|
||||||
|
|
||||||
background = m_palettes[ Neutral ].toned( 10 ).rgb();
|
{
|
||||||
onBackground = m_palettes[ Neutral ].toned( 90 ).rgb();
|
const QskHctColor color( baseColors.tertiary );
|
||||||
surface = m_palettes[ Neutral ].toned( 10 ).rgb();
|
|
||||||
onSurface = m_palettes[ Neutral ].toned( 80 ).rgb();
|
|
||||||
|
|
||||||
surfaceVariant = m_palettes[ NeutralVariant ].toned( 30 ).rgb();
|
tertiary = color.toned( 80 ).rgb();
|
||||||
onSurfaceVariant = m_palettes[ NeutralVariant ].toned( 80 ).rgb();
|
onTertiary = color.toned( 20 ).rgb();
|
||||||
outline = m_palettes[ NeutralVariant ].toned( 60 ).rgb();
|
tertiaryContainer = color.toned( 30 ).rgb();
|
||||||
outlineVariant = m_palettes[ NeutralVariant ].toned( 30 ).rgb();
|
onTertiaryContainer = color.toned( 90 ).rgb();
|
||||||
|
}
|
||||||
|
|
||||||
surfaceContainerHighest = m_palettes[ NeutralVariant ].toned( 22 ).rgb();
|
{
|
||||||
|
const QskHctColor color( baseColors.error );
|
||||||
|
|
||||||
shadow = m_palettes[ Neutral ].toned( 0 ).rgb();
|
error = color.toned( 80 ).rgb();
|
||||||
|
onError = color.toned( 20 ).rgb();
|
||||||
|
errorContainer = color.toned( 30 ).rgb();
|
||||||
|
onErrorContainer = color.toned( 90 ).rgb();
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const QskHctColor color( baseColors.neutral );
|
||||||
|
|
||||||
|
background = color.toned( 10 ).rgb();
|
||||||
|
onBackground = color.toned( 90 ).rgb();
|
||||||
|
surface = color.toned( 10 ).rgb();
|
||||||
|
onSurface = color.toned( 80 ).rgb();
|
||||||
|
shadow = color.toned( 0 ).rgb();
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const QskHctColor color( baseColors.neutralVariant );
|
||||||
|
|
||||||
|
surfaceVariant = color.toned( 30 ).rgb();
|
||||||
|
onSurfaceVariant = color.toned( 80 ).rgb();
|
||||||
|
outline = color.toned( 60 ).rgb();
|
||||||
|
outlineVariant = color.toned( 30 ).rgb();
|
||||||
|
surfaceContainerHighest = color.toned( 22 ).rgb();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
primary8 = QskRgb::toTransparentF( primary, 0.08 );
|
primary8 = QskRgb::toTransparentF( primary, 0.08 );
|
||||||
|
|
|
@ -8,30 +8,30 @@
|
||||||
|
|
||||||
#include "QskMaterial3Global.h"
|
#include "QskMaterial3Global.h"
|
||||||
|
|
||||||
#include <QskBoxShapeMetrics.h>
|
|
||||||
#include <QskHctColor.h>
|
|
||||||
#include <QskSkin.h>
|
#include <QskSkin.h>
|
||||||
|
#include <QskBoxShapeMetrics.h>
|
||||||
#include <QskShadowMetrics.h>
|
#include <QskShadowMetrics.h>
|
||||||
|
|
||||||
#include <array>
|
#include <qcolor.h>
|
||||||
|
|
||||||
class QSK_MATERIAL3_EXPORT QskMaterial3Theme
|
class QSK_MATERIAL3_EXPORT QskMaterial3Theme
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum PaletteType
|
class BaseColors
|
||||||
{
|
{
|
||||||
Primary,
|
public:
|
||||||
Secondary,
|
BaseColors() = default;
|
||||||
Tertiary,
|
|
||||||
Error,
|
|
||||||
Neutral,
|
|
||||||
NeutralVariant,
|
|
||||||
|
|
||||||
NumPaletteTypes
|
QRgb primary = 0xff6750A4;
|
||||||
|
QRgb secondary = 0xff625B71;
|
||||||
|
QRgb tertiary = 0xff7D5260;
|
||||||
|
QRgb error = 0xffB3261E;
|
||||||
|
QRgb neutral = 0xff605D62;
|
||||||
|
QRgb neutralVariant = 0xff605D66;
|
||||||
};
|
};
|
||||||
|
|
||||||
QskMaterial3Theme( QskSkin::ColorScheme );
|
QskMaterial3Theme( QskSkin::ColorScheme );
|
||||||
QskMaterial3Theme( QskSkin::ColorScheme, std::array< QskHctColor, NumPaletteTypes > );
|
QskMaterial3Theme( QskSkin::ColorScheme, const BaseColors& );
|
||||||
|
|
||||||
QRgb primary;
|
QRgb primary;
|
||||||
QRgb primary8; // ### rename to primaryHovered or so?
|
QRgb primary8; // ### rename to primaryHovered or so?
|
||||||
|
@ -94,9 +94,6 @@ class QSK_MATERIAL3_EXPORT QskMaterial3Theme
|
||||||
const qreal draggedOpacity = 0.16;
|
const qreal draggedOpacity = 0.16;
|
||||||
|
|
||||||
QskBoxShapeMetrics shapeExtraSmallTop;
|
QskBoxShapeMetrics shapeExtraSmallTop;
|
||||||
|
|
||||||
private:
|
|
||||||
std::array< QskHctColor, NumPaletteTypes > m_palettes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class QSK_MATERIAL3_EXPORT QskMaterial3Skin : public QskSkin
|
class QSK_MATERIAL3_EXPORT QskMaterial3Skin : public QskSkin
|
||||||
|
@ -137,7 +134,7 @@ class QSK_MATERIAL3_EXPORT QskMaterial3Skin : public QskSkin
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupFonts();
|
void setupFonts();
|
||||||
void setupGraphicFilters( const QskMaterial3Theme& palette );
|
void setupGraphicFilters( const QskMaterial3Theme& );
|
||||||
void setGraphicColor( GraphicRole, QRgb );
|
void setGraphicColor( GraphicRole, QRgb );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue