summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-11-05 15:51:51 +0100
committerPetr Mrázek <peterix@gmail.com>2016-11-06 00:17:02 +0100
commit13b575f7a90ef97f3b30f2a2f74bd19d58d375e7 (patch)
tree4fffdae5bc645bd57d072bf5c3581a2b7613abc8 /application
parent495e752f8aef2774702890b8edc93de592c66984 (diff)
downloadMultiMC-13b575f7a90ef97f3b30f2a2f74bd19d58d375e7.tar
MultiMC-13b575f7a90ef97f3b30f2a2f74bd19d58d375e7.tar.gz
MultiMC-13b575f7a90ef97f3b30f2a2f74bd19d58d375e7.tar.lz
MultiMC-13b575f7a90ef97f3b30f2a2f74bd19d58d375e7.tar.xz
MultiMC-13b575f7a90ef97f3b30f2a2f74bd19d58d375e7.zip
GH-1711 fix inactive element shading in Dark and Bright themes
Diffstat (limited to 'application')
-rw-r--r--application/CMakeLists.txt2
-rw-r--r--application/themes/BrightTheme.cpp8
-rw-r--r--application/themes/BrightTheme.h5
-rw-r--r--application/themes/DarkTheme.cpp8
-rw-r--r--application/themes/DarkTheme.h5
-rw-r--r--application/themes/FusionTheme.cpp32
-rw-r--r--application/themes/FusionTheme.h14
7 files changed, 54 insertions, 20 deletions
diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt
index 38729de4..5ac7001d 100644
--- a/application/CMakeLists.txt
+++ b/application/CMakeLists.txt
@@ -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
diff --git a/application/themes/BrightTheme.cpp b/application/themes/BrightTheme.cpp
index b4d59b1f..83d8f0b2 100644
--- a/application/themes/BrightTheme.cpp
+++ b/application/themes/BrightTheme.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));
}
diff --git a/application/themes/BrightTheme.h b/application/themes/BrightTheme.h
index e7e0f834..85b7041b 100644
--- a/application/themes/BrightTheme.h
+++ b/application/themes/BrightTheme.h
@@ -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;
diff --git a/application/themes/DarkTheme.cpp b/application/themes/DarkTheme.cpp
index 497be1f4..143dd533 100644
--- a/application/themes/DarkTheme.cpp
+++ b/application/themes/DarkTheme.cpp
@@ -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));
}
diff --git a/application/themes/DarkTheme.h b/application/themes/DarkTheme.h
index 8552851d..a8c17de7 100644
--- a/application/themes/DarkTheme.h
+++ b/application/themes/DarkTheme.h
@@ -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;
diff --git a/application/themes/FusionTheme.cpp b/application/themes/FusionTheme.cpp
new file mode 100644
index 00000000..fa2ccf64
--- /dev/null
+++ b/application/themes/FusionTheme.cpp
@@ -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;
+}
+
diff --git a/application/themes/FusionTheme.h b/application/themes/FusionTheme.h
new file mode 100644
index 00000000..2f938eb9
--- /dev/null
+++ b/application/themes/FusionTheme.h
@@ -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);
+};