summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-03-30 21:48:28 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-03-30 21:48:28 +0200
commit8bf25f3d803c1a7ed110c4cf622d8a233b171ab2 (patch)
treeabc971974e089bd4bc1c7f577be19a290a7a09be
parentd35cc3dda4dc08dd16d9d12d5f96863d831fd6c7 (diff)
Set palette globally
-rw-r--r--resources/styles/nheko-dark.qss28
-rw-r--r--resources/styles/nheko.qss29
-rw-r--r--src/UserSettingsPage.cpp35
-rw-r--r--src/timeline/TimelineViewManager.cpp35
4 files changed, 90 insertions, 37 deletions
diff --git a/resources/styles/nheko-dark.qss b/resources/styles/nheko-dark.qss
index b0b3f96d..74a23c59 100644
--- a/resources/styles/nheko-dark.qss
+++ b/resources/styles/nheko-dark.qss
@@ -32,7 +32,6 @@ UserMentionsWidget > * {
QLineEdit,
QListWidget,
-QToolTip,
WelcomePage,
LoginPage,
RegisterPage,
@@ -178,12 +177,33 @@ UserInfoWidget {
border-bottom: 1px solid #202228;
}
-#UserSettingScrollWidget > QComboBox {
+QToolTip,
+QPushButton,
+QComboBox,
+QAbstractItemView,
+QMenu,
+QComboBox > * {
+ background: white;
color: #202228;
}
-#UserSettingScrollWidget > QComboBox {
- color: #202228;
+QComboBox:hover,
+QAbstractItemView::item:hover,
+QMenu::item:hover,
+QPushButton:hover {
+ background: #38a3d8;
+ selection-background-color: #38a3d8;
+}
+
+
+QMenu::item {
+ border: 1px solid transparent; /* reserve space for selection border */
+}
+
+QAbstractItemView::item:selected,
+QMenu::item:selected {
+ border-color: darkblue;
+ background: grey;
}
Avatar {
diff --git a/resources/styles/nheko.qss b/resources/styles/nheko.qss
index d5d98ed4..2ccbdba9 100644
--- a/resources/styles/nheko.qss
+++ b/resources/styles/nheko.qss
@@ -184,11 +184,33 @@ TopSection {
WelcomePage,
LoginPage,
QToolTip,
+QComboBox,
+QPushButton,
RegisterPage {
background-color: white;
color: #333;
}
+QMenu {
+ background-color: white;
+ color: #333;
+ border: 1px solid darkblue;
+}
+
+QComboBox:hover,
+QAbstractItemView::item:hover,
+QMenu::item:hover,
+QPushButton:hover {
+ background: #38a3d8;
+ selection-background-color: #38a3d8;
+}
+
+QAbstractItemView::item:selected,
+QMenu::item:selected {
+ border-color: darkblue;
+ background: grey;
+}
+
emoji--Panel,
emoji--Panel > * {
background-color: #eee;
@@ -222,6 +244,13 @@ TextField {
qproperty-labelColor: #333;
}
+TextInputWidget,
+QTextEdit,
+QLineEdit {
+ background-color: white;
+ color: #333;
+}
+
TextInputWidget {
border: none;
border-top: 1px solid #dcdcdc;
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp
index 6cd9a95c..f89b5224 100644
--- a/src/UserSettingsPage.cpp
+++ b/src/UserSettingsPage.cpp
@@ -103,12 +103,43 @@ UserSettings::applyTheme()
{
QFile stylefile;
- if (theme() == "light") {
+ static QPalette original;
+ if (this->theme() == "light") {
stylefile.setFileName(":/styles/styles/nheko.qss");
- } else if (theme() == "dark") {
+ QPalette lightActive(/*windowText*/ QColor("#333"),
+ /*button*/ QColor("#333"),
+ /*light*/ QColor(),
+ /*dark*/ QColor(220, 220, 220),
+ /*mid*/ QColor(),
+ /*text*/ QColor("#333"),
+ /*bright_text*/ QColor(),
+ /*base*/ QColor(220, 220, 220),
+ /*window*/ QColor("white"));
+ lightActive.setColor(QPalette::ToolTipBase, lightActive.base().color());
+ lightActive.setColor(QPalette::ToolTipText, lightActive.text().color());
+ lightActive.setColor(QPalette::Link, QColor("#0077b5"));
+ lightActive.setColor(QPalette::ButtonText, QColor("gray"));
+ QApplication::setPalette(lightActive);
+ } else if (this->theme() == "dark") {
stylefile.setFileName(":/styles/styles/nheko-dark.qss");
+ QPalette darkActive(/*windowText*/ QColor("#caccd1"),
+ /*button*/ QColor("#caccd1"),
+ /*light*/ QColor(),
+ /*dark*/ QColor("#2d3139"),
+ /*mid*/ QColor(),
+ /*text*/ QColor("#caccd1"),
+ /*bright_text*/ QColor(0xff, 0xff, 0xff),
+ /*base*/ QColor("#2d3139"),
+ /*window*/ QColor("#202228"));
+ darkActive.setColor(QPalette::Highlight, QColor("#38a3d8"));
+ darkActive.setColor(QPalette::ToolTipBase, darkActive.base().color());
+ darkActive.setColor(QPalette::ToolTipText, darkActive.text().color());
+ darkActive.setColor(QPalette::Link, QColor("#38a3d8"));
+ darkActive.setColor(QPalette::ButtonText, QColor("gray"));
+ QApplication::setPalette(darkActive);
} else {
stylefile.setFileName(":/styles/styles/system.qss");
+ QApplication::setPalette(original);
}
stylefile.open(QFile::ReadOnly);
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index 634ff4d6..794c13aa 100644
--- a/src/timeline/TimelineViewManager.cpp
+++ b/src/timeline/TimelineViewManager.cpp
@@ -22,38 +22,11 @@ TimelineViewManager::updateColorPalette()
userColors.clear();
if (settings->theme() == "light") {
- QPalette lightActive(/*windowText*/ QColor("#333"),
- /*button*/ QColor("#333"),
- /*light*/ QColor(),
- /*dark*/ QColor(220, 220, 220),
- /*mid*/ QColor(),
- /*text*/ QColor("#333"),
- /*bright_text*/ QColor(),
- /*base*/ QColor(220, 220, 220),
- /*window*/ QColor("white"));
- lightActive.setColor(QPalette::ToolTipBase, lightActive.base().color());
- lightActive.setColor(QPalette::ToolTipText, lightActive.text().color());
- lightActive.setColor(QPalette::Link, QColor("#0077b5"));
- lightActive.setColor(QPalette::ButtonText, QColor("gray"));
- view->rootContext()->setContextProperty("currentActivePalette", lightActive);
- view->rootContext()->setContextProperty("currentInactivePalette", lightActive);
+ view->rootContext()->setContextProperty("currentActivePalette", QPalette());
+ view->rootContext()->setContextProperty("currentInactivePalette", QPalette());
} else if (settings->theme() == "dark") {
- QPalette darkActive(/*windowText*/ QColor("#caccd1"),
- /*button*/ QColor("#caccd1"),
- /*light*/ QColor(),
- /*dark*/ QColor("#2d3139"),
- /*mid*/ QColor(),
- /*text*/ QColor("#caccd1"),
- /*bright_text*/ QColor(0xff, 0xff, 0xff),
- /*base*/ QColor("#2d3139"),
- /*window*/ QColor("#202228"));
- darkActive.setColor(QPalette::Highlight, QColor("#e7e7e9"));
- darkActive.setColor(QPalette::ToolTipBase, darkActive.base().color());
- darkActive.setColor(QPalette::ToolTipText, darkActive.text().color());
- darkActive.setColor(QPalette::Link, QColor("#38a3d8"));
- darkActive.setColor(QPalette::ButtonText, QColor("gray"));
- view->rootContext()->setContextProperty("currentActivePalette", darkActive);
- view->rootContext()->setContextProperty("currentInactivePalette", darkActive);
+ view->rootContext()->setContextProperty("currentActivePalette", QPalette());
+ view->rootContext()->setContextProperty("currentInactivePalette", QPalette());
} else {
view->rootContext()->setContextProperty("currentActivePalette", QPalette());
view->rootContext()->setContextProperty("currentInactivePalette", nullptr);