summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2017-05-30 11:57:06 -0700
committerAnders Broman <a.broman58@gmail.com>2017-06-01 08:07:05 +0000
commit6a37b542e4f1c6de7646d7ebe7fdfa2825fa0453 (patch)
tree4692beb0f863a8718a473fe8d53a6ce9cd266124 /ui
parent9719bac5ee8df89cefd4f750acdc5ef75cc75e63 (diff)
downloadwireshark-6a37b542e4f1c6de7646d7ebe7fdfa2825fa0453.tar.gz
Qt+prefs: Add a dark theme check and default colors.
Add prefs_set_gui_theme_is_dark and call it in the WiresharkApplication constructor. Add a set of dark syntax color defaults. We could alternatively add a preference for the syntax foreground color, but that would imply adding a preference for the background color as well. Bug: 11131 Bug: 13738 Change-Id: Iefe135ed04e63372ed434c5b9759647c9f4046e3 Reviewed-on: https://code.wireshark.org/review/21827 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/wireshark_application.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 93fb1ec675..8414cb4502 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -833,6 +833,10 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) :
#endif
qApp->setStyleSheet(app_style_sheet);
+ // If our window text is lighter than the window background, assume the theme is dark.
+ QPalette gui_pal = QGuiApplication::palette();
+ prefs_set_gui_theme_is_dark(gui_pal.windowText().color().value() > gui_pal.window().color().value());
+
#ifdef HAVE_SOFTWARE_UPDATE
connect(this, SIGNAL(softwareUpdateQuit()), this, SLOT(quit()), Qt::QueuedConnection);
#endif