From 6a37b542e4f1c6de7646d7ebe7fdfa2825fa0453 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Tue, 30 May 2017 11:57:06 -0700 Subject: 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 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- ui/qt/wireshark_application.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ui') 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 -- cgit v1.2.1