GH-1711 fix inactive element shading in Dark and Bright themes
This commit is contained in:
parent
495e752f8a
commit
13b575f7a9
@ -107,6 +107,8 @@ SET(MULTIMC_SOURCES
|
||||
InstanceWindow.cpp
|
||||
|
||||
# GUI - themes
|
||||
themes/FusionTheme.cpp
|
||||
themes/FusionTheme.h
|
||||
themes/BrightTheme.cpp
|
||||
themes/BrightTheme.h
|
||||
themes/DarkTheme.cpp
|
||||
|
@ -10,11 +10,6 @@ QString BrightTheme::name()
|
||||
return QObject::tr("Bright");
|
||||
}
|
||||
|
||||
QString BrightTheme::qtTheme()
|
||||
{
|
||||
return "Fusion";
|
||||
}
|
||||
|
||||
QPalette BrightTheme::colorScheme()
|
||||
{
|
||||
QPalette brightPalette;
|
||||
@ -29,10 +24,9 @@ QPalette BrightTheme::colorScheme()
|
||||
brightPalette.setColor(QPalette::ButtonText, QColor(49,54,59));
|
||||
brightPalette.setColor(QPalette::BrightText, Qt::red);
|
||||
brightPalette.setColor(QPalette::Link, QColor(41, 128, 185));
|
||||
|
||||
brightPalette.setColor(QPalette::Highlight, QColor(61, 174, 233));
|
||||
brightPalette.setColor(QPalette::HighlightedText, QColor(239,240,241));
|
||||
return brightPalette;
|
||||
return fadeInactive(brightPalette, 0.5f, QColor(239,240,241));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,13 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "ITheme.h"
|
||||
#include "FusionTheme.h"
|
||||
|
||||
class BrightTheme: public ITheme
|
||||
class BrightTheme: public FusionTheme
|
||||
{
|
||||
public:
|
||||
virtual ~BrightTheme() {}
|
||||
|
||||
QString qtTheme() override;
|
||||
QString id() override;
|
||||
QString name() override;
|
||||
QString appStyleSheet() override;
|
||||
|
@ -10,11 +10,6 @@ QString DarkTheme::name()
|
||||
return QObject::tr("Dark");
|
||||
}
|
||||
|
||||
QString DarkTheme::qtTheme()
|
||||
{
|
||||
return "Fusion";
|
||||
}
|
||||
|
||||
QPalette DarkTheme::colorScheme()
|
||||
{
|
||||
QPalette darkPalette;
|
||||
@ -29,10 +24,9 @@ QPalette DarkTheme::colorScheme()
|
||||
darkPalette.setColor(QPalette::ButtonText, Qt::white);
|
||||
darkPalette.setColor(QPalette::BrightText, Qt::red);
|
||||
darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
|
||||
|
||||
darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
|
||||
darkPalette.setColor(QPalette::HighlightedText, Qt::black);
|
||||
return darkPalette;
|
||||
return fadeInactive(darkPalette, 0.5f, QColor(49,54,59));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,13 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "ITheme.h"
|
||||
#include "FusionTheme.h"
|
||||
|
||||
class DarkTheme: public ITheme
|
||||
class DarkTheme: public FusionTheme
|
||||
{
|
||||
public:
|
||||
virtual ~DarkTheme() {}
|
||||
|
||||
QString qtTheme() override;
|
||||
QString id() override;
|
||||
QString name() override;
|
||||
QString appStyleSheet() override;
|
||||
|
32
application/themes/FusionTheme.cpp
Normal file
32
application/themes/FusionTheme.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "FusionTheme.h"
|
||||
#include "rainbow.h"
|
||||
|
||||
QString FusionTheme::qtTheme()
|
||||
{
|
||||
return "Fusion";
|
||||
}
|
||||
|
||||
QPalette FusionTheme::fadeInactive(QPalette in, qreal bias, QColor color)
|
||||
{
|
||||
auto blend = [&in, bias, color](QPalette::ColorRole role)
|
||||
{
|
||||
QColor from = in.color(QPalette::Active, role);
|
||||
QColor blended = Rainbow::mix(from, color, bias);
|
||||
in.setColor(QPalette::Disabled, role, blended);
|
||||
};
|
||||
blend(QPalette::Window);
|
||||
blend(QPalette::WindowText);
|
||||
blend(QPalette::Base);
|
||||
blend(QPalette::AlternateBase);
|
||||
blend(QPalette::ToolTipBase);
|
||||
blend(QPalette::ToolTipText);
|
||||
blend(QPalette::Text);
|
||||
blend(QPalette::Button);
|
||||
blend(QPalette::ButtonText);
|
||||
blend(QPalette::BrightText);
|
||||
blend(QPalette::Link);
|
||||
blend(QPalette::Highlight);
|
||||
blend(QPalette::HighlightedText);
|
||||
return in;
|
||||
}
|
||||
|
14
application/themes/FusionTheme.h
Normal file
14
application/themes/FusionTheme.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "ITheme.h"
|
||||
|
||||
class FusionTheme: public ITheme
|
||||
{
|
||||
public:
|
||||
virtual ~FusionTheme() {}
|
||||
|
||||
QString qtTheme() override;
|
||||
|
||||
protected:
|
||||
QPalette fadeInactive(QPalette in, qreal bias, QColor color);
|
||||
};
|
Loading…
Reference in New Issue
Block a user