comparison view/ViewManager.cpp @ 1577:2c974337f306 background-mode

Pick accent colour from OS theme if appropriate
author Chris Cannam
date Thu, 23 Jan 2020 15:43:51 +0000
parents 9c4a057302ff
children 199dbb3547d4
comparison
equal deleted inserted replaced
1576:9c4a057302ff 1577:2c974337f306
19 #include "base/RealTime.h" 19 #include "base/RealTime.h"
20 #include "data/model/Model.h" 20 #include "data/model/Model.h"
21 #include "widgets/CommandHistory.h" 21 #include "widgets/CommandHistory.h"
22 #include "View.h" 22 #include "View.h"
23 #include "Overview.h" 23 #include "Overview.h"
24
25 #include "system/System.h"
24 26
25 #include <QSettings> 27 #include <QSettings>
26 #include <QApplication> 28 #include <QApplication>
27 #include <QStyleFactory> 29 #include <QStyleFactory>
28 30
85 QColor("#c7c7c7"), // Mid 87 QColor("#c7c7c7"), // Mid
86 QColor("#000000"), // Text 88 QColor("#000000"), // Text
87 QColor("#ffffff"), // BrightText 89 QColor("#ffffff"), // BrightText
88 QColor("#ffffff"), // Base 90 QColor("#ffffff"), // Base
89 QColor("#efefef")); // Window 91 QColor("#efefef")); // Window
90 92
93 m_lightPalette.setColor(QPalette::Highlight, Qt::darkBlue);
94 if (!OSReportsDarkThemeActive()) {
95 int r, g, b;
96 if (OSQueryAccentColour(r, g, b)) {
97 m_lightPalette.setColor(QPalette::Highlight, QColor(r, g, b));
98 }
99 }
91 100
92 } else { 101 } else {
93 // i.e. widgets are currently light; create a dark palette in 102 // i.e. widgets are currently light; create a dark palette in
94 // case we are asked to switch to it, but don't create a light 103 // case we are asked to switch to it, but don't create a light
95 // one because it will be assigned from the actual application 104 // one because it will be assigned from the actual application
104 QColor("#ffffff"), // BrightText 113 QColor("#ffffff"), // BrightText
105 QColor("#000000"), // Base 114 QColor("#000000"), // Base
106 QColor("#202020")); // Window 115 QColor("#202020")); // Window
107 116
108 m_darkPalette.setColor(QPalette::Highlight, QColor(25, 130, 220)); 117 m_darkPalette.setColor(QPalette::Highlight, QColor(25, 130, 220));
118 if (OSReportsDarkThemeActive()) {
119 int r, g, b;
120 if (OSQueryAccentColour(r, g, b)) {
121 m_darkPalette.setColor(QPalette::Highlight, QColor(r, g, b));
122 }
123 }
124
109 m_darkPalette.setColor(QPalette::Link, QColor(50, 175, 255)); 125 m_darkPalette.setColor(QPalette::Link, QColor(50, 175, 255));
110 m_darkPalette.setColor(QPalette::LinkVisited, QColor(50, 175, 255)); 126 m_darkPalette.setColor(QPalette::LinkVisited, QColor(50, 175, 255));
111 127
112 m_darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, 128 m_darkPalette.setColor(QPalette::Disabled, QPalette::WindowText,
113 QColor("#808080")); 129 QColor("#808080"));