diff --git a/skins/fluent2/CMakeLists.txt b/skins/fluent2/CMakeLists.txt index 8ae6de16..2441647f 100644 --- a/skins/fluent2/CMakeLists.txt +++ b/skins/fluent2/CMakeLists.txt @@ -4,7 +4,9 @@ ############################################################################ set(SOURCES - QskFluent2Global.h QskFluent2Skin.h QskFluent2Skin.cpp + QskFluent2Global.h + QskFluent2Theme.h QskFluent2Theme.cpp + QskFluent2Skin.h QskFluent2Skin.cpp QskFluent2SkinFactory.h QskFluent2SkinFactory.cpp ) qt_add_resources(SOURCES icons.qrc) diff --git a/skins/fluent2/QskFluent2Global.h b/skins/fluent2/QskFluent2Global.h index 5c8a1aec..0a58068e 100644 --- a/skins/fluent2/QskFluent2Global.h +++ b/skins/fluent2/QskFluent2Global.h @@ -6,7 +6,7 @@ #ifndef QSK_FLUENT2_GLOBAL_H #define QSK_FLUENT2_GLOBAL_H -#include "QskGlobal.h" +#include #ifdef QSK_DLL diff --git a/skins/fluent2/QskFluent2Skin.cpp b/skins/fluent2/QskFluent2Skin.cpp index f589e83a..18559b93 100644 --- a/skins/fluent2/QskFluent2Skin.cpp +++ b/skins/fluent2/QskFluent2Skin.cpp @@ -3,20 +3,20 @@ * SPDX-License-Identifier: BSD-3-Clause *****************************************************************************/ +/* + Definitions ( where possible ) taken from + https://www.figma.com/file/NAWMapFlXnoOb86Q2H5GKr/Windows-UI-(Community) + */ #include "QskFluent2Skin.h" +#include "QskFluent2Theme.h" #include #include #include #include -#include #include #include -#include -#include -#include -#include #include #include #include @@ -45,6 +45,10 @@ #include #include #include +#include +#include +#include +#include #include #include @@ -56,6 +60,20 @@ namespace { + inline QFont createFont( const QString& name, qreal lineHeight, + qreal size, qreal tracking, QFont::Weight weight ) + { + QFont font( name, qRound( size ) ); + font.setPixelSize( qRound( lineHeight ) ); + + if( !qskFuzzyCompare( tracking, 0.0 ) ) + font.setLetterSpacing( QFont::AbsoluteSpacing, tracking ); + + font.setWeight( weight ); + + return font; + } + inline constexpr QRgb rgbGray( int value, qreal opacity = 1.0 ) { return qRgba( value, value, value, qRound( opacity * 255 ) ); @@ -124,20 +142,6 @@ namespace const QskFluent2Theme& theme; }; - - QFont createFont( const QString& name, qreal lineHeight, - qreal size, qreal tracking, QFont::Weight weight ) - { - QFont font( name, qRound( size ) ); - font.setPixelSize( qRound( lineHeight ) ); - - if( !qskFuzzyCompare( tracking, 0.0 ) ) - font.setLetterSpacing( QFont::AbsoluteSpacing, tracking ); - - font.setWeight( weight ); - - return font; - } } void Editor::setup() @@ -694,6 +698,7 @@ void Editor::setupSpinBox() setStrutSize( Q::UpPanel, 32, 20 ); setPadding( Q::UpPanel, { 11, 7, 11, 7 } ); + setStrutSize( Q::DownPanel, 34, 20 ); setPadding( Q::DownPanel, { 11, 7, 13, 7 } ); @@ -946,231 +951,6 @@ void Editor::setupVirtualKeyboard() setPadding( Q::Panel, 8 ); } -QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme ) - : QskFluent2Theme( colorScheme, - { // default Fluent accent colors: - 0xff98ecfe, - 0xff60ccfe, - 0xff0093f9, - 0xff0078d4, - 0xff005eb7, - 0xff003d92, - 0xff001968 - } ) -{ -} - -QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme, - const std::array< QRgb, NumAccentColors >& accentColors ) -{ - if( colorScheme == QskSkin::Light ) - { - // Fill color: - - palette.fillColor.text.primary = rgbGray( 0, 0.8956 ); - palette.fillColor.text.secondary = rgbGray( 0, 0.6063 ); - palette.fillColor.text.tertiary = rgbGray( 0, 0.4458 ); - palette.fillColor.text.disabled = rgbGray( 0, 0.3614 ); - - palette.fillColor.accentText.primary = accentColors[ AccentDark2 ]; - palette.fillColor.accentText.secondary = accentColors[ AccentDark3 ]; - palette.fillColor.accentText.tertiary = accentColors[ AccentDark1 ]; - palette.fillColor.accentText.disabled = rgbGray( 0, 0.3614 ); - - palette.fillColor.textOnAccent.primary = rgbGray( 255 ); - palette.fillColor.textOnAccent.secondary = rgbGray( 255, 0.70 ); - palette.fillColor.textOnAccent.disabled = rgbGray( 255 ); - palette.fillColor.textOnAccent.selectedText = rgbGray( 255 ); - - palette.fillColor.control.defaultColor = rgbGray( 255, 0.70 ); - palette.fillColor.control.secondary = rgbGray( 249, 0.50 ); - palette.fillColor.control.tertiary = rgbGray( 249, 0.30 ); - palette.fillColor.control.inputActive = rgbGray( 255 ); - palette.fillColor.control.disabled = rgbGray( 249, 0.30 ); - - palette.fillColor.controlStrong.defaultColor = rgbGray( 0, 0.4458 ); - palette.fillColor.controlStrong.disabled = rgbGray( 0, 0.3173 ); - - palette.fillColor.subtle.secondary = rgbGray( 0, 0.0373 ); - palette.fillColor.subtle.tertiary = rgbGray( 0, 0.0241 ); - palette.fillColor.subtle.disabled = Qt::transparent; - - palette.fillColor.controlSolid.defaultColor = rgbGray( 255 ); - - palette.fillColor.controlAlt.secondary = rgbGray( 0, 0.0241 ); - palette.fillColor.controlAlt.tertiary = rgbGray( 0, 0.0578 ); - palette.fillColor.controlAlt.quaternary = rgbGray( 0, 0.0924 ); - palette.fillColor.controlAlt.disabled = Qt::transparent; - - palette.fillColor.accent.defaultColor = accentColors[ AccentDark1 ]; - palette.fillColor.accent.secondary = QskRgb::toTransparentF( accentColors[ AccentDark1 ], 0.90 ); - palette.fillColor.accent.tertiary = QskRgb::toTransparentF( accentColors[ AccentDark1 ], 0.80 ); - palette.fillColor.accent.disabled = rgbGray( 0, 0.2169 ); - palette.fillColor.accent.selectedTextBackground = accentColors[ AccentBase ]; - - // Elevation: - - palette.elevation.control.border = { rgbGray( 0, 0.0578 ), rgbGray( 0, 0.1622 ) }; - palette.elevation.circle.border = { rgbGray( 0, 0.0578 ), rgbGray( 0, 0.1622 ) }; - palette.elevation.textControl.border = { rgbGray( 0, 0.0578 ), palette.fillColor.text.secondary }; - palette.elevation.textControl.borderFocused = { rgbGray( 0, 0.0578 ), rgbGray( 0, 0.0578 ) }; - palette.elevation.accentControl.border = { rgbGray( 255, 0.08 ), rgbGray( 0, 0.40 ) }; - - // Stroke color: - - palette.strokeColor.control.defaultColor = rgbGray( 0, 0.0578 ); - palette.strokeColor.control.secondary = rgbGray( 0, 0.1622 ); - palette.strokeColor.control.onAccentDefault = rgbGray( 255.08 ); - palette.strokeColor.control.onAccentSecondary = rgbGray( 0, 0.40 ); - palette.strokeColor.control.onAccentTertiary = rgbGray( 0, 0.2169 ); - palette.strokeColor.control.onAccentDisabled = rgbGray( 0, 0.0578 ); - - palette.strokeColor.controlStrong.defaultColor = rgbGray( 0, 0.4458 ); - palette.strokeColor.controlStrong.disabled = rgbGray( 0, 0.2169 ); - - palette.strokeColor.card.defaultColor = rgbGray( 0, 0.0578 ); - palette.strokeColor.card.defaultSolid = rgbGray( 235 ); - - palette.strokeColor.divider.defaultColor = rgbGray( 0, 0.0803 ); - - palette.strokeColor.surface.defaultColor = rgbGray( 117, 0.40 ); - palette.strokeColor.surface.flyout = rgbGray( 0, 0.0578 ); - - palette.strokeColor.focus.outer = rgbGray( 0, 0.8956 ); - palette.strokeColor.focus.inner = rgbGray( 255 ); - - // Background: - - palette.background.card.defaultColor = rgbGray( 255, 0.70 ); - palette.background.card.secondary = rgbGray( 246, 0.50 ); - palette.background.card.tertiary = rgbGray( 255 ); - - palette.background.overlay.defaultColor = rgbGray( 0, 0.30 ); - - palette.background.layer.alt = rgbGray( 255 ); - - palette.background.flyout.defaultColor = rgbGray( 252, 0.85 ); - - palette.background.solid.base = rgbGray( 243 ); - palette.background.solid.secondary = rgbGray( 238 ); - palette.background.solid.tertiary = rgbGray( 249 ); - palette.background.solid.quaternary = rgbGray( 255 ); - - - // Shadow: - - shadow.cardRest = { QskShadowMetrics( 0, 4, QPointF( 0, 2 ) ), rgbGray( 0, 0.04 ) }; - shadow.cardHover = { QskShadowMetrics( 0, 4, QPointF( 0, 2 ) ), rgbGray( 0, 0.10 ) }; - shadow.flyout = { QskShadowMetrics( 0, 16, QPointF( 0, 8 ) ), rgbGray( 0, 0.14 ) }; - // ### should actually be drawn twice with different values: - shadow.dialog = { QskShadowMetrics( 0, 21, QPointF( 0, 2 ) ), rgbGray( 0, 0.1474 ) }; - } - else if( colorScheme == QskSkin::Dark ) - { - // Fill color: - - palette.fillColor.text.primary = rgbGray( 255 ); - palette.fillColor.text.secondary = rgbGray( 255, 0.786 ); - palette.fillColor.text.tertiary = rgbGray( 255, 0.5442 ); - palette.fillColor.text.disabled = rgbGray( 255, 0.3628 ); - - palette.fillColor.accentText.primary = accentColors[ AccentLight3 ]; - palette.fillColor.accentText.secondary = accentColors[ AccentLight3 ]; - palette.fillColor.accentText.tertiary = accentColors[ AccentLight2 ]; - palette.fillColor.accentText.disabled = rgbGray( 255, 0.3628 ); - - palette.fillColor.textOnAccent.primary = rgbGray( 0 ); - palette.fillColor.textOnAccent.secondary = rgbGray( 0, 0.50 ); - palette.fillColor.textOnAccent.disabled = rgbGray( 255, 0.5302 ); - palette.fillColor.textOnAccent.selectedText = rgbGray( 255 ); - - palette.fillColor.control.defaultColor = rgbGray( 255, 0.0605 ); - palette.fillColor.control.secondary = rgbGray( 255, 0.0837 ); - palette.fillColor.control.tertiary = rgbGray( 255, 0.0326 ); - palette.fillColor.control.inputActive = rgbGray( 30, 0.70 ); - palette.fillColor.control.disabled = rgbGray( 255, 0.0419 ); - - palette.fillColor.controlStrong.defaultColor = rgbGray( 255, 0.5442 ); - palette.fillColor.controlStrong.disabled = rgbGray( 255, 0.2465 ); - - palette.fillColor.subtle.secondary = rgbGray( 255, 0.0605 ); - palette.fillColor.subtle.tertiary = rgbGray( 255, 0.0419 ); - palette.fillColor.subtle.disabled = Qt::transparent; - - palette.fillColor.controlSolid.defaultColor = rgbGray( 69 ); - - palette.fillColor.controlAlt.secondary = rgbGray( 0, 0.10 ); - palette.fillColor.controlAlt.tertiary = rgbGray( 255, 0.0419 ); - palette.fillColor.controlAlt.quaternary = rgbGray( 255, 0.0698 ); - palette.fillColor.controlAlt.disabled = Qt::transparent; - - palette.fillColor.accent.defaultColor = accentColors[ AccentLight2 ]; - palette.fillColor.accent.secondary = QskRgb::toTransparentF( accentColors[ AccentLight2 ], 0.90 ); - palette.fillColor.accent.tertiary = QskRgb::toTransparentF( accentColors[ AccentLight2 ], 0.80 ); - palette.fillColor.accent.disabled = rgbGray( 255, 0.1581 ); - palette.fillColor.accent.selectedTextBackground = accentColors[ AccentBase ]; - - // Elevation: - - palette.elevation.control.border = { rgbGray( 255, 0.093 ), rgbGray( 255, 0.0698 ) }; - palette.elevation.circle.border = { rgbGray( 255, 0.093 ), rgbGray( 255, 0.0698 ) }; - - palette.elevation.textControl.border = { rgbGray( 255, 0.08 ), palette.fillColor.text.secondary }; - - palette.elevation.textControl.borderFocused = { rgbGray( 255, 0.08 ), rgbGray( 255, 0.08 ) }; - palette.elevation.accentControl.border = { rgbGray( 255, 0.08 ), rgbGray( 0, 0.14 ) }; - - // Stroke color: - - palette.strokeColor.control.defaultColor = rgbGray( 255, 0.0698 ); - palette.strokeColor.control.secondary = rgbGray( 255, 0.093 ); - palette.strokeColor.control.onAccentDefault = rgbGray( 255, 0.08 ); - palette.strokeColor.control.onAccentSecondary = rgbGray( 0, 0.14 ); - palette.strokeColor.control.onAccentTertiary = rgbGray( 0, 0.2169 ); - palette.strokeColor.control.onAccentDisabled = rgbGray( 0, 0.20 ); - - palette.strokeColor.controlStrong.defaultColor = rgbGray( 255, 0.5442 ); - palette.strokeColor.controlStrong.disabled = rgbGray( 255, 0.1581 ); - - palette.strokeColor.card.defaultColor = rgbGray( 255, 0.0578 ); - palette.strokeColor.card.defaultSolid = rgbGray( 235 ); - - palette.strokeColor.divider.defaultColor = rgbGray( 255, 0.0837 ); - - palette.strokeColor.surface.defaultColor = rgbGray( 117, 0.40 ); - palette.strokeColor.surface.flyout = rgbGray( 0, 0.20 ); - - palette.strokeColor.focus.outer = rgbGray( 255 ); - palette.strokeColor.focus.inner = rgbGray( 0, 0.70 ); - - // Background: - - palette.background.card.defaultColor = rgbGray( 255, 0.0512 ); - palette.background.card.secondary = rgbGray( 255, 0.0326 ); - palette.background.card.tertiary = rgbGray( 255 ); // not set in Figma - - palette.background.overlay.defaultColor = rgbGray( 0, 0.30 ); - - palette.background.layer.alt = rgbGray( 255, 0.0538 ); - - palette.background.flyout.defaultColor = rgbGray( 44, 0.96 ); - - palette.background.solid.base = rgbGray( 32 ); - palette.background.solid.secondary = rgbGray( 28 ); - palette.background.solid.tertiary = rgbGray( 40 ); - palette.background.solid.quaternary = rgbGray( 44 ); - - - // Shadow: - - shadow.cardRest = { QskShadowMetrics( 0, 4, QPointF( 0, 2 ) ), rgbGray( 0, 0.13 ) }; - shadow.cardHover = { QskShadowMetrics( 0, 4, QPointF( 0, 2 ) ), rgbGray( 0, 0.26 ) }; - shadow.flyout = { QskShadowMetrics( 0, 16, QPointF( 0, 8 ) ), rgbGray( 0, 0.26 ) }; - // ### should actually be drawn twice with different values: - shadow.dialog = { QskShadowMetrics( 0, 21, QPointF( 0, 2 ) ), rgbGray( 0, 0.37 ) }; - } -} - QskFluent2Skin::QskFluent2Skin( const QskFluent2Theme& palette, QObject* parent ) : Inherited( parent ) { diff --git a/skins/fluent2/QskFluent2Skin.h b/skins/fluent2/QskFluent2Skin.h index 826eee34..f731327f 100644 --- a/skins/fluent2/QskFluent2Skin.h +++ b/skins/fluent2/QskFluent2Skin.h @@ -7,228 +7,9 @@ #define QSK_FLUENT2_SKIN_H #include "QskFluent2Global.h" - -#include -#include -#include #include -#include - -class QSK_FLUENT2_EXPORT QskFluent2Theme -{ - public: - enum AccentColors - { - AccentLight3, - AccentLight2, - AccentLight1, - AccentBase, - AccentDark1, - AccentDark2, - AccentDark3, - - NumAccentColors - }; - - QskFluent2Theme( QskSkin::ColorScheme ); - QskFluent2Theme( QskSkin::ColorScheme, const std::array< QRgb, NumAccentColors >& ); - - typedef std::array< QRgb, 2 > BorderGradient; - - struct FillColor - { - struct - { - QRgb primary; - QRgb secondary; - QRgb tertiary; - QRgb disabled; - } text; - - struct - { - QRgb primary; - QRgb secondary; - QRgb tertiary; - QRgb disabled; - } accentText; - - struct - { - QRgb primary; - QRgb secondary; - QRgb tertiary; - QRgb disabled; - QRgb selectedText; - } textOnAccent; - - struct - { - QRgb defaultColor; - QRgb secondary; - QRgb tertiary; - QRgb inputActive; - QRgb disabled; - } control; - - struct - { - QRgb defaultColor; - QRgb disabled; - } controlStrong; - - struct - { - QRgb secondary; - QRgb tertiary; - QRgb disabled; - } subtle; - - struct - { - QRgb defaultColor; - } controlSolid; - - struct - { - QRgb secondary; - QRgb tertiary; - QRgb quaternary; - QRgb disabled; - } controlAlt; - - struct - { - QRgb defaultColor; - QRgb secondary; - QRgb tertiary; - QRgb disabled; - QRgb selectedTextBackground; - } accent; - }; - - struct Elevation - { - struct - { - BorderGradient border; - } control; - - struct - { - BorderGradient border; - } circle; - - struct - { - BorderGradient border; - BorderGradient borderFocused; - } textControl; - - struct - { - BorderGradient border; - } accentControl; - }; - - struct StrokeColor - { - struct - { - QRgb defaultColor; - QRgb secondary; - QRgb onAccentDefault; - QRgb onAccentSecondary; - QRgb onAccentTertiary; - QRgb onAccentDisabled; - } control; - - struct - { - QRgb defaultColor; - QRgb disabled; - } controlStrong; - - struct - { - QRgb defaultColor; - QRgb defaultSolid; - } card; - - struct - { - QRgb defaultColor; - } divider; - - struct - { - QRgb defaultColor; - QRgb flyout; - } surface; - - struct - { - QRgb outer; - QRgb inner; - } focus; - }; - - struct Background - { - struct - { - QRgb defaultColor; - QRgb secondary; - QRgb tertiary; - } card; - - struct - { - QRgb defaultColor; - } overlay; - - struct - { - QRgb alt; - } layer; - - struct - { - QRgb defaultColor; - } flyout; - - struct - { - QRgb base; - QRgb secondary; - QRgb tertiary; - QRgb quaternary; - } solid; - }; - - struct - { - FillColor fillColor; - Elevation elevation; - StrokeColor strokeColor; - Background background; - } palette; - - struct ShadowSettings - { - QskShadowMetrics metrics; - QRgb color; - }; - - struct - { - ShadowSettings cardRest; - ShadowSettings cardHover; - ShadowSettings flyout; - ShadowSettings dialog; - } shadow; -}; +class QskFluent2Theme; class QSK_FLUENT2_EXPORT QskFluent2Skin : public QskSkin { @@ -238,7 +19,7 @@ class QSK_FLUENT2_EXPORT QskFluent2Skin : public QskSkin public: QskFluent2Skin( const QskFluent2Theme&, QObject* parent = nullptr ); - ~QskFluent2Skin() override; + ~QskFluent2Skin() override; enum GraphicRole { @@ -267,7 +48,7 @@ class QSK_FLUENT2_EXPORT QskFluent2Skin : public QskSkin private: void setupFonts(); - void setupGraphicFilters( const QskFluent2Theme& palette ); + void setupGraphicFilters( const QskFluent2Theme& ); void setGraphicColor( GraphicRole, QRgb ); }; diff --git a/skins/fluent2/QskFluent2SkinFactory.cpp b/skins/fluent2/QskFluent2SkinFactory.cpp index 4d015c4b..a98afd83 100644 --- a/skins/fluent2/QskFluent2SkinFactory.cpp +++ b/skins/fluent2/QskFluent2SkinFactory.cpp @@ -5,6 +5,7 @@ #include "QskFluent2SkinFactory.h" #include "QskFluent2Skin.h" +#include "QskFluent2Theme.h" static const QString fluent2LightSkinName = QStringLiteral( "Fluent2 Light" ); static const QString fluent2DarkSkinName = QStringLiteral( "Fluent2 Dark" ); diff --git a/skins/fluent2/QskFluent2SkinFactory.h b/skins/fluent2/QskFluent2SkinFactory.h index 3903bf73..3b081862 100644 --- a/skins/fluent2/QskFluent2SkinFactory.h +++ b/skins/fluent2/QskFluent2SkinFactory.h @@ -19,7 +19,7 @@ class QSK_FLUENT2_EXPORT QskFluent2SkinFactory : public QskSkinFactory public: QskFluent2SkinFactory( QObject* parent = nullptr ); - ~QskFluent2SkinFactory() override; + ~QskFluent2SkinFactory() override; QStringList skinNames() const override; QskSkin* createSkin( const QString& skinName ) override; diff --git a/skins/fluent2/QskFluent2Theme.cpp b/skins/fluent2/QskFluent2Theme.cpp new file mode 100644 index 00000000..10ae8ed2 --- /dev/null +++ b/skins/fluent2/QskFluent2Theme.cpp @@ -0,0 +1,240 @@ +/****************************************************************************** + * QSkinny - Copyright (C) 2023 Edelhirsch Software GmbH + * SPDX-License-Identifier: BSD-3-Clause + *****************************************************************************/ + +#include "QskFluent2Theme.h" +#include + +namespace +{ + inline constexpr QRgb rgbGray( int value, qreal opacity = 1.0 ) + { + return qRgba( value, value, value, qRound( opacity * 255 ) ); + } +} + +QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme ) + : QskFluent2Theme( colorScheme, + { // default Fluent accent colors: + 0xff98ecfe, + 0xff60ccfe, + 0xff0093f9, + 0xff0078d4, + 0xff005eb7, + 0xff003d92, + 0xff001968 + } ) +{ +} + +QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme, + const std::array< QRgb, NumAccentColors >& accentColors ) +{ + if( colorScheme == QskSkin::Light ) + { + // Fill color: + + palette.fillColor.text.primary = rgbGray( 0, 0.8956 ); + palette.fillColor.text.secondary = rgbGray( 0, 0.6063 ); + palette.fillColor.text.tertiary = rgbGray( 0, 0.4458 ); + palette.fillColor.text.disabled = rgbGray( 0, 0.3614 ); + + palette.fillColor.accentText.primary = accentColors[ AccentDark2 ]; + palette.fillColor.accentText.secondary = accentColors[ AccentDark3 ]; + palette.fillColor.accentText.tertiary = accentColors[ AccentDark1 ]; + palette.fillColor.accentText.disabled = rgbGray( 0, 0.3614 ); + + palette.fillColor.textOnAccent.primary = rgbGray( 255 ); + palette.fillColor.textOnAccent.secondary = rgbGray( 255, 0.70 ); + palette.fillColor.textOnAccent.disabled = rgbGray( 255 ); + palette.fillColor.textOnAccent.selectedText = rgbGray( 255 ); + + palette.fillColor.control.defaultColor = rgbGray( 255, 0.70 ); + palette.fillColor.control.secondary = rgbGray( 249, 0.50 ); + palette.fillColor.control.tertiary = rgbGray( 249, 0.30 ); + palette.fillColor.control.inputActive = rgbGray( 255 ); + palette.fillColor.control.disabled = rgbGray( 249, 0.30 ); + + palette.fillColor.controlStrong.defaultColor = rgbGray( 0, 0.4458 ); + palette.fillColor.controlStrong.disabled = rgbGray( 0, 0.3173 ); + + palette.fillColor.subtle.secondary = rgbGray( 0, 0.0373 ); + palette.fillColor.subtle.tertiary = rgbGray( 0, 0.0241 ); + palette.fillColor.subtle.disabled = Qt::transparent; + + palette.fillColor.controlSolid.defaultColor = rgbGray( 255 ); + + palette.fillColor.controlAlt.secondary = rgbGray( 0, 0.0241 ); + palette.fillColor.controlAlt.tertiary = rgbGray( 0, 0.0578 ); + palette.fillColor.controlAlt.quaternary = rgbGray( 0, 0.0924 ); + palette.fillColor.controlAlt.disabled = Qt::transparent; + + palette.fillColor.accent.defaultColor = accentColors[ AccentDark1 ]; + palette.fillColor.accent.secondary = QskRgb::toTransparentF( accentColors[ AccentDark1 ], 0.90 ); + palette.fillColor.accent.tertiary = QskRgb::toTransparentF( accentColors[ AccentDark1 ], 0.80 ); + palette.fillColor.accent.disabled = rgbGray( 0, 0.2169 ); + palette.fillColor.accent.selectedTextBackground = accentColors[ AccentBase ]; + + // Elevation: + + palette.elevation.control.border = { rgbGray( 0, 0.0578 ), rgbGray( 0, 0.1622 ) }; + palette.elevation.circle.border = { rgbGray( 0, 0.0578 ), rgbGray( 0, 0.1622 ) }; + palette.elevation.textControl.border = { rgbGray( 0, 0.0578 ), palette.fillColor.text.secondary }; + palette.elevation.textControl.borderFocused = { rgbGray( 0, 0.0578 ), rgbGray( 0, 0.0578 ) }; + palette.elevation.accentControl.border = { rgbGray( 255, 0.08 ), rgbGray( 0, 0.40 ) }; + + // Stroke color: + + palette.strokeColor.control.defaultColor = rgbGray( 0, 0.0578 ); + palette.strokeColor.control.secondary = rgbGray( 0, 0.1622 ); + palette.strokeColor.control.onAccentDefault = rgbGray( 255.08 ); + palette.strokeColor.control.onAccentSecondary = rgbGray( 0, 0.40 ); + palette.strokeColor.control.onAccentTertiary = rgbGray( 0, 0.2169 ); + palette.strokeColor.control.onAccentDisabled = rgbGray( 0, 0.0578 ); + + palette.strokeColor.controlStrong.defaultColor = rgbGray( 0, 0.4458 ); + palette.strokeColor.controlStrong.disabled = rgbGray( 0, 0.2169 ); + + palette.strokeColor.card.defaultColor = rgbGray( 0, 0.0578 ); + palette.strokeColor.card.defaultSolid = rgbGray( 235 ); + + palette.strokeColor.divider.defaultColor = rgbGray( 0, 0.0803 ); + + palette.strokeColor.surface.defaultColor = rgbGray( 117, 0.40 ); + palette.strokeColor.surface.flyout = rgbGray( 0, 0.0578 ); + + palette.strokeColor.focus.outer = rgbGray( 0, 0.8956 ); + palette.strokeColor.focus.inner = rgbGray( 255 ); + + // Background: + + palette.background.card.defaultColor = rgbGray( 255, 0.70 ); + palette.background.card.secondary = rgbGray( 246, 0.50 ); + palette.background.card.tertiary = rgbGray( 255 ); + + palette.background.overlay.defaultColor = rgbGray( 0, 0.30 ); + + palette.background.layer.alt = rgbGray( 255 ); + + palette.background.flyout.defaultColor = rgbGray( 252, 0.85 ); + + palette.background.solid.base = rgbGray( 243 ); + palette.background.solid.secondary = rgbGray( 238 ); + palette.background.solid.tertiary = rgbGray( 249 ); + palette.background.solid.quaternary = rgbGray( 255 ); + + + // Shadow: + + shadow.cardRest = { QskShadowMetrics( 0, 4, QPointF( 0, 2 ) ), rgbGray( 0, 0.04 ) }; + shadow.cardHover = { QskShadowMetrics( 0, 4, QPointF( 0, 2 ) ), rgbGray( 0, 0.10 ) }; + shadow.flyout = { QskShadowMetrics( 0, 16, QPointF( 0, 8 ) ), rgbGray( 0, 0.14 ) }; + // ### should actually be drawn twice with different values: + shadow.dialog = { QskShadowMetrics( 0, 21, QPointF( 0, 2 ) ), rgbGray( 0, 0.1474 ) }; + } + else if( colorScheme == QskSkin::Dark ) + { + // Fill color: + + palette.fillColor.text.primary = rgbGray( 255 ); + palette.fillColor.text.secondary = rgbGray( 255, 0.786 ); + palette.fillColor.text.tertiary = rgbGray( 255, 0.5442 ); + palette.fillColor.text.disabled = rgbGray( 255, 0.3628 ); + + palette.fillColor.accentText.primary = accentColors[ AccentLight3 ]; + palette.fillColor.accentText.secondary = accentColors[ AccentLight3 ]; + palette.fillColor.accentText.tertiary = accentColors[ AccentLight2 ]; + palette.fillColor.accentText.disabled = rgbGray( 255, 0.3628 ); + + palette.fillColor.textOnAccent.primary = rgbGray( 0 ); + palette.fillColor.textOnAccent.secondary = rgbGray( 0, 0.50 ); + palette.fillColor.textOnAccent.disabled = rgbGray( 255, 0.5302 ); + palette.fillColor.textOnAccent.selectedText = rgbGray( 255 ); + + palette.fillColor.control.defaultColor = rgbGray( 255, 0.0605 ); + palette.fillColor.control.secondary = rgbGray( 255, 0.0837 ); + palette.fillColor.control.tertiary = rgbGray( 255, 0.0326 ); + palette.fillColor.control.inputActive = rgbGray( 30, 0.70 ); + palette.fillColor.control.disabled = rgbGray( 255, 0.0419 ); + + palette.fillColor.controlStrong.defaultColor = rgbGray( 255, 0.5442 ); + palette.fillColor.controlStrong.disabled = rgbGray( 255, 0.2465 ); + + palette.fillColor.subtle.secondary = rgbGray( 255, 0.0605 ); + palette.fillColor.subtle.tertiary = rgbGray( 255, 0.0419 ); + palette.fillColor.subtle.disabled = Qt::transparent; + + palette.fillColor.controlSolid.defaultColor = rgbGray( 69 ); + + palette.fillColor.controlAlt.secondary = rgbGray( 0, 0.10 ); + palette.fillColor.controlAlt.tertiary = rgbGray( 255, 0.0419 ); + palette.fillColor.controlAlt.quaternary = rgbGray( 255, 0.0698 ); + palette.fillColor.controlAlt.disabled = Qt::transparent; + + palette.fillColor.accent.defaultColor = accentColors[ AccentLight2 ]; + palette.fillColor.accent.secondary = QskRgb::toTransparentF( accentColors[ AccentLight2 ], 0.90 ); + palette.fillColor.accent.tertiary = QskRgb::toTransparentF( accentColors[ AccentLight2 ], 0.80 ); + palette.fillColor.accent.disabled = rgbGray( 255, 0.1581 ); + palette.fillColor.accent.selectedTextBackground = accentColors[ AccentBase ]; + + // Elevation: + + palette.elevation.control.border = { rgbGray( 255, 0.093 ), rgbGray( 255, 0.0698 ) }; + palette.elevation.circle.border = { rgbGray( 255, 0.093 ), rgbGray( 255, 0.0698 ) }; + + palette.elevation.textControl.border = { rgbGray( 255, 0.08 ), palette.fillColor.text.secondary }; + + palette.elevation.textControl.borderFocused = { rgbGray( 255, 0.08 ), rgbGray( 255, 0.08 ) }; + palette.elevation.accentControl.border = { rgbGray( 255, 0.08 ), rgbGray( 0, 0.14 ) }; + + // Stroke color: + + palette.strokeColor.control.defaultColor = rgbGray( 255, 0.0698 ); + palette.strokeColor.control.secondary = rgbGray( 255, 0.093 ); + palette.strokeColor.control.onAccentDefault = rgbGray( 255, 0.08 ); + palette.strokeColor.control.onAccentSecondary = rgbGray( 0, 0.14 ); + palette.strokeColor.control.onAccentTertiary = rgbGray( 0, 0.2169 ); + palette.strokeColor.control.onAccentDisabled = rgbGray( 0, 0.20 ); + + palette.strokeColor.controlStrong.defaultColor = rgbGray( 255, 0.5442 ); + palette.strokeColor.controlStrong.disabled = rgbGray( 255, 0.1581 ); + + palette.strokeColor.card.defaultColor = rgbGray( 255, 0.0578 ); + palette.strokeColor.card.defaultSolid = rgbGray( 235 ); + + palette.strokeColor.divider.defaultColor = rgbGray( 255, 0.0837 ); + + palette.strokeColor.surface.defaultColor = rgbGray( 117, 0.40 ); + palette.strokeColor.surface.flyout = rgbGray( 0, 0.20 ); + + palette.strokeColor.focus.outer = rgbGray( 255 ); + palette.strokeColor.focus.inner = rgbGray( 0, 0.70 ); + + // Background: + + palette.background.card.defaultColor = rgbGray( 255, 0.0512 ); + palette.background.card.secondary = rgbGray( 255, 0.0326 ); + palette.background.card.tertiary = rgbGray( 255 ); // not set in Figma + + palette.background.overlay.defaultColor = rgbGray( 0, 0.30 ); + + palette.background.layer.alt = rgbGray( 255, 0.0538 ); + + palette.background.flyout.defaultColor = rgbGray( 44, 0.96 ); + + palette.background.solid.base = rgbGray( 32 ); + palette.background.solid.secondary = rgbGray( 28 ); + palette.background.solid.tertiary = rgbGray( 40 ); + palette.background.solid.quaternary = rgbGray( 44 ); + + + // Shadow: + + shadow.cardRest = { QskShadowMetrics( 0, 4, QPointF( 0, 2 ) ), rgbGray( 0, 0.13 ) }; + shadow.cardHover = { QskShadowMetrics( 0, 4, QPointF( 0, 2 ) ), rgbGray( 0, 0.26 ) }; + shadow.flyout = { QskShadowMetrics( 0, 16, QPointF( 0, 8 ) ), rgbGray( 0, 0.26 ) }; + // ### should actually be drawn twice with different values: + shadow.dialog = { QskShadowMetrics( 0, 21, QPointF( 0, 2 ) ), rgbGray( 0, 0.37 ) }; + } +} diff --git a/skins/fluent2/QskFluent2Theme.h b/skins/fluent2/QskFluent2Theme.h new file mode 100644 index 00000000..af563871 --- /dev/null +++ b/skins/fluent2/QskFluent2Theme.h @@ -0,0 +1,232 @@ +/****************************************************************************** + * QSkinny - Copyright (C) 2023 Edelhirsch Software GmbH + * SPDX-License-Identifier: BSD-3-Clause + *****************************************************************************/ + +#ifndef QSK_FLUENT2_THEME_H +#define QSK_FLUENT2_THEME_H + +#include "QskFluent2Global.h" + +#include +#include + +#include +#include + +class QSK_FLUENT2_EXPORT QskFluent2Theme +{ + public: + enum AccentColors + { + AccentLight3, + AccentLight2, + AccentLight1, + AccentBase, + AccentDark1, + AccentDark2, + AccentDark3, + + NumAccentColors + }; + + QskFluent2Theme( QskSkin::ColorScheme ); + QskFluent2Theme( QskSkin::ColorScheme, const std::array< QRgb, NumAccentColors >& ); + + typedef std::array< QRgb, 2 > BorderGradient; + + struct FillColor + { + struct + { + QRgb primary; + QRgb secondary; + QRgb tertiary; + QRgb disabled; + } text; + + struct + { + QRgb primary; + QRgb secondary; + QRgb tertiary; + QRgb disabled; + } accentText; + + struct + { + QRgb primary; + QRgb secondary; + QRgb tertiary; + QRgb disabled; + QRgb selectedText; + } textOnAccent; + + struct + { + QRgb defaultColor; + QRgb secondary; + QRgb tertiary; + QRgb inputActive; + QRgb disabled; + } control; + + struct + { + QRgb defaultColor; + QRgb disabled; + } controlStrong; + + struct + { + QRgb secondary; + QRgb tertiary; + QRgb disabled; + } subtle; + + struct + { + QRgb defaultColor; + } controlSolid; + + struct + { + QRgb secondary; + QRgb tertiary; + QRgb quaternary; + QRgb disabled; + } controlAlt; + + struct + { + QRgb defaultColor; + QRgb secondary; + QRgb tertiary; + QRgb disabled; + QRgb selectedTextBackground; + } accent; + }; + + struct Elevation + { + struct + { + BorderGradient border; + } control; + + struct + { + BorderGradient border; + } circle; + + struct + { + BorderGradient border; + BorderGradient borderFocused; + } textControl; + + struct + { + BorderGradient border; + } accentControl; + }; + + struct StrokeColor + { + struct + { + QRgb defaultColor; + QRgb secondary; + QRgb onAccentDefault; + QRgb onAccentSecondary; + QRgb onAccentTertiary; + QRgb onAccentDisabled; + } control; + + struct + { + QRgb defaultColor; + QRgb disabled; + } controlStrong; + + struct + { + QRgb defaultColor; + QRgb defaultSolid; + } card; + + struct + { + QRgb defaultColor; + } divider; + + struct + { + QRgb defaultColor; + QRgb flyout; + } surface; + + struct + { + QRgb outer; + QRgb inner; + } focus; + }; + + struct Background + { + struct + { + QRgb defaultColor; + QRgb secondary; + QRgb tertiary; + } card; + + struct + { + QRgb defaultColor; + } overlay; + + struct + { + QRgb alt; + } layer; + + struct + { + QRgb defaultColor; + } flyout; + + struct + { + QRgb base; + QRgb secondary; + QRgb tertiary; + QRgb quaternary; + } solid; + }; + + struct + { + FillColor fillColor; + Elevation elevation; + StrokeColor strokeColor; + Background background; + } palette; + + struct ShadowSettings + { + QskShadowMetrics metrics; + QRgb color; + }; + + struct + { + ShadowSettings cardRest; + ShadowSettings cardHover; + ShadowSettings flyout; + ShadowSettings dialog; + } shadow; +}; + +#endif