diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-10-21 09:07:26 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-10-21 09:07:26 +0200 |
commit | 872cfe036d9472739939ad401dbe9511193d62ca (patch) | |
tree | 2d8356848c4955b09d66d6fc96924cc4da85ccb9 /application/themes | |
parent | f07496ac6d42986266f3bff5093fa0009521ecd5 (diff) | |
download | MultiMC-872cfe036d9472739939ad401dbe9511193d62ca.tar MultiMC-872cfe036d9472739939ad401dbe9511193d62ca.tar.gz MultiMC-872cfe036d9472739939ad401dbe9511193d62ca.tar.lz MultiMC-872cfe036d9472739939ad401dbe9511193d62ca.tar.xz MultiMC-872cfe036d9472739939ad401dbe9511193d62ca.zip |
GH-903 simple theme switching and dark theme
Diffstat (limited to 'application/themes')
-rw-r--r-- | application/themes/DarkTheme.cpp | 37 | ||||
-rw-r--r-- | application/themes/DarkTheme.h | 14 | ||||
-rw-r--r-- | application/themes/ITheme.h | 13 | ||||
-rw-r--r-- | application/themes/SystemTheme.cpp | 28 | ||||
-rw-r--r-- | application/themes/SystemTheme.h | 19 |
5 files changed, 111 insertions, 0 deletions
diff --git a/application/themes/DarkTheme.cpp b/application/themes/DarkTheme.cpp new file mode 100644 index 00000000..7445dedf --- /dev/null +++ b/application/themes/DarkTheme.cpp @@ -0,0 +1,37 @@ +#include "DarkTheme.h" + +QString DarkTheme::id() +{ + return "dark"; +} + +QString DarkTheme::name() +{ + return QObject::tr("Dark"); +} + +QPalette DarkTheme::colorScheme() +{ + QPalette darkPalette; + darkPalette.setColor(QPalette::Window, QColor(49,54,59)); + darkPalette.setColor(QPalette::WindowText, Qt::white); + darkPalette.setColor(QPalette::Base, QColor(35,38,41)); + darkPalette.setColor(QPalette::AlternateBase, QColor(49,54,59)); + darkPalette.setColor(QPalette::ToolTipBase, Qt::white); + darkPalette.setColor(QPalette::ToolTipText, Qt::white); + darkPalette.setColor(QPalette::Text, Qt::white); + darkPalette.setColor(QPalette::Button, QColor(49,54,59)); + 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; +} + + +QString DarkTheme::appStyleSheet() +{ + return "QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }"; +} diff --git a/application/themes/DarkTheme.h b/application/themes/DarkTheme.h new file mode 100644 index 00000000..11e621a6 --- /dev/null +++ b/application/themes/DarkTheme.h @@ -0,0 +1,14 @@ +#pragma once + +#include "ITheme.h" + +class DarkTheme: public ITheme +{ +public: + virtual ~DarkTheme() {} + + QString id() override; + QString name() override; + QString appStyleSheet() override; + QPalette colorScheme() override; +}; diff --git a/application/themes/ITheme.h b/application/themes/ITheme.h new file mode 100644 index 00000000..8e0836eb --- /dev/null +++ b/application/themes/ITheme.h @@ -0,0 +1,13 @@ +#pragma once +#include <QString> +#include <QPalette> + +class ITheme +{ +public: + virtual ~ITheme() {} + virtual QString id() = 0; + virtual QString name() = 0; + virtual QString appStyleSheet() = 0; + virtual QPalette colorScheme() = 0; +}; diff --git a/application/themes/SystemTheme.cpp b/application/themes/SystemTheme.cpp new file mode 100644 index 00000000..6ced6843 --- /dev/null +++ b/application/themes/SystemTheme.cpp @@ -0,0 +1,28 @@ +#include "SystemTheme.h" +#include <QApplication> +#include <QStyle> + +SystemTheme::SystemTheme() +{ + systemPalette = QApplication::style()->standardPalette(); +} + +QString SystemTheme::id() +{ + return "system"; +} + +QString SystemTheme::name() +{ + return QObject::tr("System"); +} + +QPalette SystemTheme::colorScheme() +{ + return systemPalette; +} + +QString SystemTheme::appStyleSheet() +{ + return QString(); +} diff --git a/application/themes/SystemTheme.h b/application/themes/SystemTheme.h new file mode 100644 index 00000000..90fd8ed9 --- /dev/null +++ b/application/themes/SystemTheme.h @@ -0,0 +1,19 @@ +#pragma once + +#include "ITheme.h" + +class SystemTheme: public ITheme +{ +public: + SystemTheme(); + virtual ~SystemTheme() {} + + QString id() override; + QString name() override; + QString appStyleSheet() override; + QPalette colorScheme() override; +private: + QPalette systemPalette; + QString systemTheme; +}; + |