mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
ui: Set Link Color when setting theme
Long story short, QT doesn't allow the link colors to be set via their stylesheets. There are two ways to work with this, specify the color manually for every link (See the About dialog) The other way is to change the default palette. IsDarkTheme is copy/pasted from src/yuzu/debugger/wait_tree.cpp
This commit is contained in:
parent
bf3c6f8812
commit
38dd6dc190
@ -3652,6 +3652,16 @@ void GMainWindow::UpdateUITheme() {
|
|||||||
setStyleSheet({});
|
setStyleSheet({});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPalette new_pal(qApp->palette());
|
||||||
|
if (UISettings::IsDarkTheme()) {
|
||||||
|
new_pal.setColor(QPalette::Text, QColor(255, 255, 255, 255));
|
||||||
|
new_pal.setColor(QPalette::Link, QColor(0, 190, 255, 255));
|
||||||
|
} else {
|
||||||
|
new_pal.setColor(QPalette::Text, QColor(0, 0, 0, 255));
|
||||||
|
new_pal.setColor(QPalette::Link, QColor(0, 140, 200, 255));
|
||||||
|
}
|
||||||
|
qApp->setPalette(new_pal);
|
||||||
|
|
||||||
QIcon::setThemeName(current_theme);
|
QIcon::setThemeName(current_theme);
|
||||||
QIcon::setThemeSearchPaths(theme_paths);
|
QIcon::setThemeSearchPaths(theme_paths);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,14 @@ const Themes themes{{
|
|||||||
{"Midnight Blue Colorful", "colorful_midnight_blue"},
|
{"Midnight Blue Colorful", "colorful_midnight_blue"},
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
bool IsDarkTheme() {
|
||||||
|
const auto& theme = UISettings::values.theme;
|
||||||
|
return theme == QStringLiteral("qdarkstyle") ||
|
||||||
|
theme == QStringLiteral("qdarkstyle_midnight_blue") ||
|
||||||
|
theme == QStringLiteral("colorful_dark") ||
|
||||||
|
theme == QStringLiteral("colorful_midnight_blue");
|
||||||
|
}
|
||||||
|
|
||||||
Values values = {};
|
Values values = {};
|
||||||
|
|
||||||
} // namespace UISettings
|
} // namespace UISettings
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
namespace UISettings {
|
namespace UISettings {
|
||||||
|
|
||||||
|
bool IsDarkTheme();
|
||||||
|
|
||||||
struct ContextualShortcut {
|
struct ContextualShortcut {
|
||||||
QString keyseq;
|
QString keyseq;
|
||||||
QString controller_keyseq;
|
QString controller_keyseq;
|
||||||
|
Loading…
Reference in New Issue
Block a user