├── CMakeLists.txt
├── README.md
├── include
├── ThemeDialog
├── ThemeSupport
└── ThemeSupportConfigurationWidget
├── src
├── ThemeDialog.cpp
├── ThemeDialog.h
├── ThemeSupport.cpp
├── ThemeSupport.h
├── ThemeSupportConfigurationWidget.cpp
├── ThemeSupportConfigurationWidget.h
├── ThemeSupportConfigurationWidget.ui
├── ThemeSupportConfigurationWidget_linux.cpp
├── ThemeSupportConfigurationWidget_mac.cpp
├── ThemeSupportConfigurationWidget_windows.cpp
├── ThemeSupportSpec.h
├── ThemeSupport_linux.cpp
├── ThemeSupport_mac.mm
├── ThemeSupport_windows.cpp
├── Version.h.in
├── resources.qrc
└── version.rc
└── themes
├── linux_dark.palette
├── linux_dark.qss
├── linux_light.palette
├── macos_dark.palette
├── macos_dark.qss
├── macos_light.palette
├── windows_dark.palette
├── windows_dark.qss
└── windows_light.palette
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2020 Adrian Carpenter
3 | #
4 | # This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | #
6 | # An open-source cross-platform traceroute analyser.
7 | #
8 | # Created by Adrian Carpenter on 31/03/2021.
9 | #
10 | # This program is free software: you can redistribute it and/or modify
11 | # it under the terms of the GNU General Public License as published by
12 | # the Free Software Foundation, either version 3 of the License, or
13 | # (at your option) any later version.
14 | #
15 | # This program is distributed in the hope that it will be useful,
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | # GNU General Public License for more details.
19 | #
20 | # You should have received a copy of the GNU General Public License
21 | # along with this program. If not, see .
22 | #
23 |
24 | cmake_minimum_required(VERSION 3.10)
25 |
26 | set(CMAKE_CXX_STANDARD 17)
27 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
28 |
29 | set(CMAKE_AUTOMOC ON)
30 | set(CMAKE_AUTOUIC ON)
31 | set(CMAKE_AUTORCC ON)
32 |
33 | add_definitions(-DQT_NO_KEYWORDS)
34 |
35 | add_definitions(-DNEDRYSOFT_LIBRARY_THEMESUPPORT_EXPORT)
36 |
37 | # create the font awesome library
38 |
39 | project(ThemeSupport)
40 |
41 | # discover which Qt version is available
42 |
43 | if (NOT DEFINED QT_VERSION_MAJOR)
44 | if (DEFINED USE_QT_VERSION)
45 | set(QT_VERSION_MAJOR ${USE_QT_VERSION})
46 | message(STATUS "Qt${QT_VERSION_MAJOR} has been manually selected")
47 | else()
48 | message(STATUS "Detecting Qt version")
49 |
50 | find_package(Qt6 COMPONENTS Core QUIET)
51 | find_package(Qt5 COMPONENTS Core QUIET)
52 |
53 | if (Qt6_FOUND)
54 | set(QT_VERSION_MAJOR 6)
55 | elseif(Qt5_FOUND)
56 | set(QT_VERSION_MAJOR 5)
57 | else()
58 | message(FATAL_ERROR "No valid Qt version was set, and none could be found")
59 | endif()
60 | message(STATUS "Detecting Qt version - done")
61 | endif()
62 |
63 | find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core QUIET)
64 |
65 | if (NOT Qt${QT_VERSION_MAJOR}_FOUND)
66 | message(FATAL_ERROR "Qt${QT_VERSION_MAJOR} could not be found")
67 | endif()
68 |
69 | message(STATUS "Qt major version: ${QT_VERSION_MAJOR}")
70 | endif()
71 |
72 | # end of qt selection/detection
73 |
74 | find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Widgets REQUIRED)
75 |
76 | set(Qt_LIBS Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Widgets)
77 |
78 | set(library_SOURCES
79 | src/ThemeDialog.cpp
80 | src/ThemeDialog.h
81 | src/ThemeSupportConfigurationWidget.cpp
82 | src/ThemeSupportConfigurationWidget.h
83 | src/ThemeSupportConfigurationWidget.ui
84 | src/ThemeSupport.cpp
85 | src/ThemeSupport.h
86 | src/ThemeSupportSpec.h
87 | src/resources.qrc
88 | )
89 |
90 | if(APPLE)
91 | set(platform_SOURCES
92 | src/ThemeSupport_mac.mm
93 | src/ThemeSupportConfigurationWidget_mac.cpp
94 | )
95 |
96 | set(platform_LIBS "-framework Foundation" "-framework Cocoa" "stdc++" "objc")
97 | elseif(UNIX)
98 | set(platform_SOURCES
99 | src/ThemeSupport_linux.cpp
100 | src/ThemeSupportConfigurationWidget_linux.cpp
101 | )
102 |
103 | set(platform_LIBS "")
104 | elseif(WIN32)
105 | set(platform_SOURCES
106 | src/ThemeSupport_windows.cpp
107 | src/ThemeSupportConfigurationWidget_windows.cpp
108 | )
109 | set(platform_LIBS "")
110 |
111 | configure_file("src/Version.h.in" "Version.h")
112 | list(APPEND library_SOURCES "src/version.rc")
113 | add_definitions("-DNEDRYSOFT_MODULE_FILENAME=\"${PROJECT_NAME}.dll\"")
114 | add_definitions("-DNEDRYSOFT_MODULE_NAME=\"${PROJECT_NAME}\"")
115 | endif()
116 |
117 | add_library(${PROJECT_NAME} SHARED
118 | ${library_SOURCES}
119 | ${platform_SOURCES}
120 | )
121 |
122 | if(DEFINED NEDRYSOFT_THEMESUPPORT_LIBRARY_DIR)
123 | set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${NEDRYSOFT_THEMESUPPORT_LIBRARY_DIR}")
124 | set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${NEDRYSOFT_THEMESUPPORT_LIBRARY_DIR}")
125 | else()
126 | message(STATUS "Set NEDRYSOFT_THEMESUPPORT_LIBRARY_DIR to set the binary output dir.")
127 | endif()
128 |
129 | if(APPLE)
130 | target_link_directories(${PROJECT_NAME} PRIVATE ${NEDRYSOFT_MACHELPER_LIBRARY_DIR})
131 | target_include_directories(${PROJECT_NAME} PRIVATE "${NEDRYSOFT_MACHELPER_INCLUDE_DIR}")
132 |
133 | target_link_libraries(${PROJECT_NAME} MacHelper)
134 | endif()
135 |
136 | target_link_libraries(${PROJECT_NAME} ${Qt_LIBS} ${platform_LIBS})
137 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Nedrysoft Theme Support
2 |
3 | The ThemeSupport library provides methods to detecting the system theme (light/dark mode).
4 |
5 | ## Requirements
6 |
7 | * Qt5 or Qt6
8 | * CMake
9 |
10 | ## Building
11 |
12 | To build the library, invoke CMake or open the CMakeLists.txt file in your preferred IDE.
13 |
14 | Setting the following CMake variables allows the customisation of the build.
15 |
16 | ```
17 | NEDRYSOFT_THEMESUPPORT_LIBRARY_DIR=
18 | ```
19 |
20 | Sets the output folder for the dynamic library; if omitted, you can find the binaries in the default location.
21 |
22 | # License
23 |
24 | This project is open source and released under the GPLv3 licence.
25 |
26 | Distributed as-is; no warranty is given.
27 |
--------------------------------------------------------------------------------
/include/ThemeDialog:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 31/03/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #include "../src/ThemeDialog.h"
--------------------------------------------------------------------------------
/include/ThemeSupport:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 31/03/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #include "../src/ThemeSupport.h"
--------------------------------------------------------------------------------
/include/ThemeSupportConfigurationWidget:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 17/05/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #include "../src/ThemeSupportConfigurationWidget.h"
--------------------------------------------------------------------------------
/src/ThemeDialog.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 21/05/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #include
25 |
26 | #include "ThemeDialog.h"
27 |
28 | #include "ThemeSupport.h"
29 | #if defined(Q_OS_MACOS)
30 | #include "MacHelper"
31 | #endif
32 |
33 | Nedrysoft::ThemeSupport::ThemeDialog::ThemeDialog(QWidget *parent) :
34 | QDialog(parent) {
35 |
36 | #if defined(Q_OS_MACOS)
37 | auto themeSupport = Nedrysoft::ThemeSupport::ThemeSupport::getInstance();
38 |
39 | updateTitlebar();
40 |
41 | auto signal=connect(
42 | themeSupport,
43 | &Nedrysoft::ThemeSupport::ThemeSupport::themeChanged,
44 | [=](bool isDarkMode) {
45 |
46 | updateTitlebar();
47 | }
48 | );
49 |
50 | connect(this, &QObject::destroyed, [themeSupport, signal]() {
51 | themeSupport->disconnect(signal);
52 | });
53 | #endif
54 | }
55 |
56 | auto Nedrysoft::ThemeSupport::ThemeDialog::updateTitlebar() -> void {
57 | #if defined(Q_OS_MACOS)
58 | Nedrysoft::MacHelper::MacHelper macHelper;
59 |
60 | auto themeSupport = Nedrysoft::ThemeSupport::ThemeSupport::getInstance();
61 |
62 | if (themeSupport->isForced()) {
63 | QColor colour;
64 |
65 | if (themeSupport->isDarkMode()) {
66 | colour = QColor::fromRgbF(0.23, 0.22, 0.23);
67 | } else {
68 | colour = QColor::fromRgbF(0.91, 0.90, 0.91);
69 | }
70 |
71 | macHelper.setTitlebarColour(
72 | this,
73 | colour,
74 | themeSupport->isDarkMode()
75 | );
76 | } else {
77 | macHelper.clearTitlebarColour(this, themeSupport->isDarkMode());
78 | }
79 | #endif
80 | }
81 |
82 | Nedrysoft::ThemeSupport::ThemeDialog::~ThemeDialog() {
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/src/ThemeDialog.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 21/05/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #ifndef NEDRYSOFT_THEMESUPPORT_THEMEDIALOG_H
25 | #define NEDRYSOFT_THEMESUPPORT_THEMEDIALOG_H
26 |
27 | #include "ThemeSupportSpec.h"
28 |
29 | #include
30 | #include
31 | #include
32 |
33 | namespace Nedrysoft { namespace ThemeSupport {
34 | /**
35 | * @brief ThemeDialog is a QDialog subclass that automatically applies the Light/Dark settings and responds
36 | * to changes of the application style or system changes.
37 | */
38 | class NEDRYSOFT_THEMESUPPORT_DLLSPEC ThemeDialog :
39 | public QDialog {
40 |
41 | private:
42 | Q_OBJECT
43 |
44 | public:
45 | /**
46 | * @brief Constructs a new ThemeDialog that is a child of the parent.
47 | *
48 | * @param[in] parent the parent of this child.
49 | */
50 | ThemeDialog(QWidget *parent=nullptr);
51 |
52 | /**
53 | * @brief Destroys the ThemeDialog.
54 | */
55 | ~ThemeDialog();
56 |
57 | protected:
58 | /**
59 | * @brief Updates the titlebar on macOS when the theme is being forced.
60 | */
61 | auto updateTitlebar() -> void;
62 | };
63 | }};
64 |
65 | #endif // NEDRYSOFT_THEMESUPPORT_THEMEDIALOG_H
66 |
67 |
--------------------------------------------------------------------------------
/src/ThemeSupport.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 31/03/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #include "ThemeSupport.h"
25 |
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 |
34 | #if defined(Q_OS_MACOS)
35 | constexpr auto HostPlatform = "macos";
36 | #elif defined(Q_OS_WINDOWS)
37 | constexpr auto HostPlatform = "windows";
38 | #elif defined(Q_OS_LINUX)
39 | constexpr auto HostPlatform = "linux";
40 | #else
41 | #error Unknown platform!
42 | #endif
43 |
44 | //! @cond
45 |
46 | Nedrysoft::ThemeSupport::Theme Nedrysoft::ThemeSupport::ThemeSupport::m_activeTheme =
47 | Nedrysoft::ThemeSupport::Theme::System;
48 |
49 | //! @endcond
50 |
51 | Nedrysoft::ThemeSupport::ThemeSupport::ThemeSupport() {
52 | static auto eventProxyWidget = new QWidget;
53 |
54 | connect(this, &Nedrysoft::ThemeSupport::ThemeSupport::destroyed, [=](QObject *){
55 | delete eventProxyWidget;
56 | });
57 |
58 | #if (QT_VERSION_MAJOR<6)
59 | connect(qobject_cast(QCoreApplication::instance()), &QApplication::paletteChanged, [=] (const QPalette &) {
60 | Q_EMIT themeChanged(Nedrysoft::ThemeSupport::ThemeSupport::isDarkMode());
61 | });
62 | #endif
63 |
64 | eventProxyWidget->installEventFilter(this);
65 |
66 | selectActive(m_activeTheme);
67 | }
68 |
69 | Nedrysoft::ThemeSupport::ThemeSupport::~ThemeSupport() {
70 |
71 | }
72 |
73 | auto Nedrysoft::ThemeSupport::ThemeSupport::getInstance() -> Nedrysoft::ThemeSupport::ThemeSupport * {
74 | static auto themeSupport = new Nedrysoft::ThemeSupport::ThemeSupport;
75 |
76 | return themeSupport;
77 | }
78 |
79 | #if (QT_VERSION_MAJOR>=6)
80 | auto Nedrysoft::ThemeSupport::ThemeSupport::eventFilter(QObject *object, QEvent *event) -> bool {
81 | switch(event->type()) {
82 | case QEvent::ApplicationPaletteChange: {
83 | // setMode(setMode);
84 |
85 | break;
86 | }
87 |
88 | default: {
89 | break;
90 | }
91 | }
92 |
93 | return QObject::eventFilter(object, event);
94 | }
95 | #endif
96 |
97 | auto Nedrysoft::ThemeSupport::ThemeSupport::getColor(const QRgb colourPair[]) -> QColor {
98 | return QColor(colourPair[isDarkMode() ? 1 : 0]);
99 | }
100 |
101 | auto Nedrysoft::ThemeSupport::ThemeSupport::selectActive(Nedrysoft::ThemeSupport::Theme theme) -> void {
102 | auto activeMode = systemMode();
103 | bool clearTheme = false;
104 | bool forceTheme = false;
105 |
106 | if (theme==Nedrysoft::ThemeSupport::Theme::System) {
107 | clearTheme = true;
108 | } else {
109 | switch(activeMode) {
110 | case Nedrysoft::ThemeSupport::SystemMode::Unsupported: {
111 | if (theme==Nedrysoft::ThemeSupport::Theme::Dark) {
112 | forceTheme = true;
113 | } else {
114 | clearTheme = true;
115 | }
116 |
117 | break;
118 | }
119 |
120 | case Nedrysoft::ThemeSupport::SystemMode::Light: {
121 | if (theme==Nedrysoft::ThemeSupport::Theme::Light) {
122 | clearTheme = true;
123 | } else {
124 | forceTheme = true;
125 | }
126 |
127 | break;
128 | }
129 |
130 | case Nedrysoft::ThemeSupport::SystemMode::Dark: {
131 | if (theme==Nedrysoft::ThemeSupport::Theme::Dark) {
132 | clearTheme = true;
133 | } else {
134 | forceTheme = true;
135 | }
136 |
137 | break;
138 | }
139 | }
140 | }
141 |
142 | if (clearTheme) {
143 | qApp->blockSignals(true);
144 | qApp->setPalette(qApp->style()->standardPalette());
145 | qApp->setStyleSheet("");
146 | qApp->blockSignals(false);
147 | }
148 |
149 | if (forceTheme) {
150 | if (theme==Nedrysoft::ThemeSupport::Theme::Light) {
151 | loadPalette("light");
152 | } else {
153 | loadPalette("dark");
154 | }
155 | }
156 |
157 | m_activeTheme = theme;
158 |
159 | Q_EMIT themeChanged(Nedrysoft::ThemeSupport::ThemeSupport::isDarkMode());
160 | }
161 |
162 | auto Nedrysoft::ThemeSupport::ThemeSupport::loadPalette(const QString &name) -> bool {
163 | QString paletteFilename(QString(":/Nedrysoft/ThemeSupport/themes/%1_%2.palette").arg(HostPlatform, name));
164 | QString stylesheetFilename(QString(":/Nedrysoft/ThemeSupport/themes/%1_%2.qss").arg(HostPlatform, name));
165 | QSettings *paletteSettings = nullptr;
166 | QString stylesheet;
167 |
168 | if (QFile::exists(paletteFilename)) {
169 | paletteSettings = new QSettings(paletteFilename, QSettings::IniFormat);
170 | }
171 |
172 | if (QFile::exists(stylesheetFilename)) {
173 | QFile stylesheetFile(stylesheetFilename);
174 |
175 | if (stylesheetFile.open(QFile::ReadOnly)) {
176 | stylesheet = QString::fromUtf8(stylesheetFile.readAll());
177 | }
178 | }
179 |
180 | auto fieldMatch = QRegularExpression(
181 | "\\/\\*\\s*(.*)\\s*\\*\\/",
182 | QRegularExpression::CaseInsensitiveOption);
183 |
184 | int matchPosition = 0;
185 |
186 | /*while ((matchPosition = stylesheet.indexOf(fieldMatch, matchPosition)) != -1) {
187 | // check if in map.
188 | }*/
189 |
190 | QPalette palette = qGuiApp->palette();
191 |
192 | if (paletteSettings) {
193 | auto groups = groupMap();
194 | auto roles = roleMap();
195 |
196 | for (auto group : paletteSettings->childGroups()) {
197 | paletteSettings->beginGroup(group);
198 |
199 | for (auto key : paletteSettings->allKeys()) {
200 | auto colourString = paletteSettings->value(key).toString();
201 |
202 | palette.setColor(groups[group], roles[key], colourString);
203 |
204 | if (!stylesheet.isEmpty()) {
205 | auto fullRegex = QRegularExpression(
206 | QString("\\/\\*\\s*%1\\s*\\*\\/").arg(key + "." + group));
207 |
208 | auto keyRegex = QRegularExpression(
209 | QString("\\/\\*\\s*%1\\s*\\*\\/").arg(key));
210 |
211 | stylesheet = stylesheet.replace(fullRegex, colourString);
212 | stylesheet = stylesheet.replace(keyRegex, colourString);
213 | }
214 | }
215 |
216 | paletteSettings->endGroup();
217 | }
218 |
219 | delete paletteSettings;
220 | }
221 |
222 | /**
223 | * The GTK style plugin does not allow palette changes, in order to change the GTK theme (or any other
224 | * themes that behave like it, we need to so much more stylesheet work.
225 | *
226 | * PaletteWidget *w = new PaletteWidget;
227 | * w->setPalette(palette);
228 | */
229 |
230 | qApp->blockSignals(true);
231 | qApp->setPalette(palette);
232 | qApp->setStyleSheet(stylesheet);
233 | qApp->blockSignals(false);
234 |
235 | return true;
236 | }
237 |
238 | auto Nedrysoft::ThemeSupport::ThemeSupport::savePalette(QString filename) -> bool {
239 | QSettings palette(filename, QSettings::IniFormat);
240 |
241 | QMap groups = groupMap();
242 | QMap roles = roleMap();
243 |
244 | QMapIterator groupIterator(groups);
245 |
246 | while(groupIterator.hasNext()) {
247 | auto group = groupIterator.next();
248 |
249 | QMapIterator roleIterator(roles);
250 |
251 | while(roleIterator.hasNext()) {
252 | auto role = roleIterator.next();
253 |
254 | QColor colour = qGuiApp->palette().color(group.value(), role.value());
255 |
256 | QString colourString = QString("#%1%2%3%4")
257 | .arg(colour.alpha(), 2, 16, QLatin1Char('0'))
258 | .arg(colour.red(), 2, 16, QLatin1Char('0'))
259 | .arg(colour.green(), 2, 16, QLatin1Char('0'))
260 | .arg(colour.blue(), 2, 16, QLatin1Char('0'));
261 |
262 | palette.setValue(QString("%1/%2").arg(group.key()).arg(role.key()), colourString);
263 | }
264 | }
265 |
266 | return true;
267 | }
268 |
269 | auto Nedrysoft::ThemeSupport::ThemeSupport::groupMap() -> QMap {
270 | QMap groups;
271 |
272 | groups["Disabled"] = QPalette::Disabled;
273 | groups["Active"] = QPalette::Active;
274 | groups["Inactive"] = QPalette::Inactive;
275 | groups["Normal"] = QPalette::Normal;
276 |
277 | return groups;
278 | }
279 |
280 | auto Nedrysoft::ThemeSupport::ThemeSupport::roleMap() -> QMap {
281 | QMap roles;
282 |
283 | roles["Window"] = QPalette::Window;
284 | roles["WindowText"] = QPalette::WindowText;
285 | roles["Base"] = QPalette::Base;
286 | roles["AlternateBase"] = QPalette::AlternateBase;
287 | roles["ToolTipBase"] = QPalette::ToolTipBase;
288 | roles["ToolTipText"] = QPalette::ToolTipText;
289 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 12,0))
290 | roles["PlaceholderText"] = QPalette::PlaceholderText;
291 | #endif
292 | roles["Text"] = QPalette::Text;
293 | roles["Button"] = QPalette::Button;
294 | roles["ButtonText"] = QPalette::ButtonText;
295 | roles["BrightText"] = QPalette::BrightText;
296 |
297 | roles["Light"] = QPalette::Light;
298 | roles["Midlight"] = QPalette::Midlight;
299 | roles["Dark"] = QPalette::Dark;
300 | roles["Mid"] = QPalette::Mid;
301 | roles["Shadow"] = QPalette::Shadow;
302 | roles["Highlight"] = QPalette::Highlight;
303 | roles["HighlightedText"] = QPalette::HighlightedText;
304 |
305 | roles["Link"] = QPalette::WindowText;
306 | roles["LinkVisited"] = QPalette::WindowText;
307 |
308 | return roles;
309 | }
310 |
311 | auto Nedrysoft::ThemeSupport::ThemeSupport::isForced() -> bool {
312 | if (systemMode()==Nedrysoft::ThemeSupport::SystemMode::Unsupported) {
313 | if (Nedrysoft::ThemeSupport::ThemeSupport::isDarkMode()) {
314 | return true;
315 | }
316 | } else {
317 | if (systemMode() == Nedrysoft::ThemeSupport::SystemMode::Dark) {
318 | if (!Nedrysoft::ThemeSupport::ThemeSupport::isDarkMode()) {
319 | return true;
320 | }
321 | } else {
322 | if (Nedrysoft::ThemeSupport::ThemeSupport::isDarkMode()) {
323 | return true;
324 | }
325 | }
326 | }
327 |
328 | return false;
329 | }
330 |
331 | auto Nedrysoft::ThemeSupport::ThemeSupport::initialise() -> bool {
332 | QSettings settings;
333 |
334 | auto platformTheme = settings.value(
335 | "ThemeSupport/Theme",
336 | "System").toString();
337 |
338 | if (platformTheme=="Dark") {
339 | selectActive(Nedrysoft::ThemeSupport::Theme::Dark);
340 | } else if (platformTheme=="Light") {
341 | selectActive(Nedrysoft::ThemeSupport::Theme::Light);
342 | }
343 |
344 | return true;
345 | }
346 |
--------------------------------------------------------------------------------
/src/ThemeSupport.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 31/03/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #ifndef NEDRYSOFT_THEMESUPPORT_THEMESUPPORT_H
25 | #define NEDRYSOFT_THEMESUPPORT_THEMESUPPORT_H
26 |
27 | #include
28 |
29 | #include "ThemeSupportSpec.h"
30 |
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 |
38 | namespace Nedrysoft { namespace ThemeSupport {
39 | class ThemeSupportConfigurationWidget;
40 |
41 | enum class Theme {
42 | System,
43 | Light,
44 | Dark
45 | };
46 |
47 | enum class SystemMode {
48 | Unsupported,
49 | Light,
50 | Dark
51 | };
52 |
53 | /**
54 | * @brief The ThemeSupport class provides information about the operating system theme.
55 | *
56 | * @class Nedrysoft::ThemeSupport::ThemeSupport ThemeSupport.h
57 | */
58 | class NEDRYSOFT_THEMESUPPORT_DLLSPEC ThemeSupport :
59 | public QObject {
60 |
61 | public:
62 | Q_OBJECT
63 |
64 | private:
65 | /**
66 | * @brief Constructs a new ThemeSupport instance.
67 | */
68 | explicit ThemeSupport();
69 |
70 | public:
71 | /**
72 | * @brief Destroys the ThemeSupport.
73 | */
74 | ~ThemeSupport();
75 |
76 | /**
77 | * @brief Sets the active application theme.
78 | *
79 | * @param[in] mode the to set as active.
80 | */
81 | auto selectActive(Theme theme) -> void;
82 |
83 | /**
84 | * @brief Returns whether the OS is in dark mode.
85 | *
86 | * @returns true if dark mode; otherwise false.
87 | */
88 | auto isDarkMode() -> bool;
89 |
90 | /**
91 | * @brief This signal is emitted when OS theme is changed.
92 | *
93 | * @param[in] isDarkMode true if dark mode; otherwise false.
94 | */
95 | Q_SIGNAL void themeChanged(bool isDarkMode);
96 |
97 | /**
98 | * @brief Returns the Dark or Light colour for the given array.
99 | *
100 | * @note The array consists of 2 QRgb entries, one entry is for dark and the other for light mode.
101 | *
102 | * @returns the colour.
103 | */
104 | auto getColor(const QRgb PushButtonColor[]) -> QColor;
105 |
106 | /**
107 | * @brief Returns the highlighted text background color
108 | *
109 | * @note Qt does not return the correct color when using QPalette, this function directly queries
110 | * the macOS to discover the real highlighted background color.
111 | *
112 | * @returns the colour
113 | */
114 | auto getHighlightedBackground() -> QColor;
115 |
116 | /**
117 | * @brief Loads a saved palette.
118 | *
119 | * @param[in] filename the filename of the palette to load.
120 | *
121 | * @returns true if loaded; otherwise false.
122 | */
123 | auto loadPalette(const QString &filename) -> bool;
124 |
125 | /**
126 | * @brief Saves a palette to a file.
127 | *
128 | * @param[in] filename the filename of the saved palette.
129 | *
130 | * @returns true if the palette was saved; otherwise false.
131 | */
132 | auto savePalette(QString filename) -> bool;
133 |
134 | /**
135 | * @brief Initialise the theme.
136 | *
137 | * @note This function should be called as early as possible in the application to initialise
138 | * the theming. This may be an empty function depending on the platform and the specific
139 | * mechanisms used to switch between light and dark mode.
140 | *
141 | * @returns true if the platform was initialised ok; otherwise false.
142 | */
143 | auto initialise() -> bool;
144 |
145 | /**
146 | * @brief Returns a configuration widget that the application can use.
147 | *
148 | * @returns the configuration widget (the widget is owned by the caller)
149 | */
150 | auto configurationWidget() -> Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget *;
151 |
152 | /**
153 | * @brief Returns the current selected mode if OS supports light/dark mode.
154 | *
155 | * @returns returns the currently active system mode, if the OS does not support light/dark modes then
156 | * this function will return Nedrysoft::ThemeSupport::SystemMode::Unsupported.
157 | */
158 | auto systemMode() -> Nedrysoft::ThemeSupport::SystemMode;
159 |
160 | /**
161 | * @brief Returns whether the currently selected theme is forced.
162 | *
163 | * @note This implements the logic to deal with system mode light/dark themes.
164 | *
165 | * @returns true if the selected theme is forced; otherwise false.
166 | */
167 | auto isForced() -> bool;
168 |
169 | /**
170 | * @brief Initialises the saved state for the platform specific configuration.
171 | *
172 | * @note This is a static function and is called twice, once before the application
173 | * instance is created, and again after. This allows the style to be set
174 | * by the application and overruled by the user.
175 | *
176 | * @param[in] beforeApplicationInstantiated true if called before an application instance
177 | * has been created; otherwise after.
178 | *
179 | * @returns true if the platform was initialised; otherwise false.
180 | */
181 | static auto initialisePlatform(bool beforeApplicationInstantiated) -> bool;
182 |
183 | /**
184 | * @brief Returns the singleton instance to the ThemeSupport object.
185 | *
186 | * @returns the singleton instance
187 | */
188 | static auto getInstance() -> Nedrysoft::ThemeSupport::ThemeSupport *;
189 |
190 | protected:
191 | /**
192 | * @brief Returns the map for converting from a color role string to ColorRole.
193 | *
194 | * @return a map that contains the lookup.
195 | */
196 | auto roleMap() -> QMap;
197 |
198 | /**
199 | * @brief Returns the map for converting from a color role string to ColorGroup.
200 | *
201 | * @return a map that contains the lookup.
202 | */
203 | auto groupMap() -> QMap;
204 |
205 | #if (QT_VERSION_MAJOR>=6)
206 | /**
207 | * @brief Reimplements: QObject::event(QEvent *event).
208 | *
209 | * @param[in] event the event information.
210 | *
211 | * @returns true if the event was handled; otherwise false.
212 | */
213 | auto eventFilter(QObject *object, QEvent *event) -> bool override;
214 | #endif
215 | friend class ThemeSupportConfigurationWidget;
216 |
217 | private:
218 | //! @cond
219 |
220 | static Theme m_activeTheme;
221 | static QWidget *m_eventProxyWidget;
222 |
223 | //! @endcond
224 | };
225 | }}
226 |
227 | Q_DECLARE_METATYPE(Nedrysoft::ThemeSupport::SystemMode)
228 | Q_DECLARE_METATYPE(Nedrysoft::ThemeSupport::Theme)
229 |
230 | #endif // NEDRYSOFT_THEMESUPPORT_THEMESUPPORT_H
231 |
--------------------------------------------------------------------------------
/src/ThemeSupportConfigurationWidget.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 17/05/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #include "ThemeSupportConfigurationWidget.h"
25 |
26 | #include "ThemeSupport.h"
27 | #include "ui_ThemeSupportConfigurationWidget.h"
28 |
29 | #include
30 |
31 | Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget::ThemeSupportConfigurationWidget(
32 | QWidget *parent) :
33 | QWidget(parent),
34 | ui(new Nedrysoft::ThemeSupport::Ui::ThemeSupportConfigurationWidget) {
35 |
36 | QSettings settings;
37 |
38 | ui->setupUi(this);
39 |
40 | auto defaultValue =
41 | QVariant::fromValue(Nedrysoft::ThemeSupport::Theme::System);
42 |
43 | ui->themeComboBox->addItem("System", QVariant::fromValue(Nedrysoft::ThemeSupport::Theme::System));
44 | ui->themeComboBox->addItem("Dark", QVariant::fromValue(Nedrysoft::ThemeSupport::Theme::Dark));
45 | ui->themeComboBox->addItem("Light", QVariant::fromValue(Nedrysoft::ThemeSupport::Theme::Light));
46 |
47 | connect(ui->themeComboBox, QOverload::of(&QComboBox::currentIndexChanged), [this](int index) {
48 | Q_EMIT settingsChanged();
49 |
50 | #if defined(Q_OS_MACOS)
51 | auto theme = ui->themeComboBox->itemData(index, Qt::UserRole).value();
52 |
53 | auto themeSupport = Nedrysoft::ThemeSupport::ThemeSupport::getInstance();
54 |
55 | themeSupport->selectActive(theme);
56 | #endif
57 | });
58 |
59 | auto platformTheme = settings.value("ThemeSupport/Theme","System").toString();
60 |
61 | ui->themeComboBox->blockSignals(true);
62 | ui->themeComboBox->setCurrentText(platformTheme);
63 | ui->themeComboBox->blockSignals(false);
64 |
65 | addPlatformOptions(ui->formLayout);
66 | }
67 |
68 | Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget::~ThemeSupportConfigurationWidget() {
69 | delete ui;
70 | }
71 |
72 | auto Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget::acceptSettings() -> bool {
73 | QSettings settings;
74 |
75 | settings.setValue("ThemeSupport/Theme", ui->themeComboBox->currentText());
76 |
77 | applyPlatformOptions();
78 |
79 | auto themeSupport = Nedrysoft::ThemeSupport::ThemeSupport::getInstance();
80 |
81 | themeSupport->selectActive(ui->themeComboBox->currentData().value());
82 |
83 | return true;
84 | }
85 |
86 | auto Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget::canAcceptSettings() -> bool {
87 | return true;
88 | }
89 |
90 | auto Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget::initialise() -> bool {
91 | return true;
92 | }
--------------------------------------------------------------------------------
/src/ThemeSupportConfigurationWidget.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 17/05/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #ifndef NEDRYSOFT_THEMESUPPORT_THEMESUPPORTCONFIGURATIONWIDGET_H
25 | #define NEDRYSOFT_THEMESUPPORT_THEMESUPPORTCONFIGURATIONWIDGET_H
26 |
27 | #include
28 |
29 | #include "ThemeSupportSpec.h"
30 |
31 | #include
32 |
33 | class QComboBox;
34 | class QFormLayout;
35 |
36 | namespace Nedrysoft { namespace ThemeSupport {
37 | namespace Ui {
38 | class ThemeSupportConfigurationWidget;
39 | }
40 |
41 | /**
42 | * @brief Provides a configuration widget that can be used in the host application to display & allow
43 | * changing of and theme settings.
44 | *
45 | * @class Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget ThemeSupportConfigurationWidget.h
46 | */
47 | class NEDRYSOFT_THEMESUPPORT_DLLSPEC ThemeSupportConfigurationWidget :
48 | public QWidget {
49 |
50 | private:
51 | Q_OBJECT
52 |
53 | public:
54 | /**
55 | * @brief Constructs a new ThemeSupportConfigurationWidget.
56 | *
57 | * @param[in] parent the parent for this child.
58 | */
59 | explicit ThemeSupportConfigurationWidget(QWidget *parent = nullptr);
60 |
61 | /**
62 | * @brief Destroys the ThemeSupportConfigurationWidget.
63 | */
64 | ~ThemeSupportConfigurationWidget() override;
65 |
66 | /**
67 | * @brief Initialises the settings widget.
68 | *
69 | * @returns true if initialised; otherwise false.
70 | */
71 | auto initialise() -> bool;
72 |
73 | /**
74 | * @brief Returns whether the current settings can be applied.
75 | *
76 | * @note On macOS, there is no concept of whether settings can be applied, as a setting is changed
77 | * it is immediately applied.
78 | *
79 | * @returns true if the settings are valid; otherwise false.
80 | */
81 | auto canAcceptSettings() -> bool;
82 |
83 | /**
84 | * @brief Applies the current settings.
85 | *
86 | * @returns true if the settings were applied (saved); otherwise false.
87 | */
88 | auto acceptSettings() -> bool;
89 |
90 | /**
91 | * @brief Add platform specific options to the existing form.
92 | */
93 | auto addPlatformOptions(QFormLayout *layout) -> void;
94 |
95 | /**
96 | * @brief Apply platform scific options.
97 | */
98 | auto applyPlatformOptions() -> void;
99 |
100 | /**
101 | * @brief This signal is emitted when the settings have been changed.
102 | */
103 | Q_SIGNAL void settingsChanged();
104 |
105 | private:
106 | //! @cond
107 |
108 | Ui::ThemeSupportConfigurationWidget *ui;
109 |
110 | #if defined(Q_OS_LINUX)
111 | QComboBox *m_themeComboBox;
112 | #endif
113 |
114 | //! @endcond
115 | };
116 | }}
117 |
118 | #endif // NEDRYSOFT_THEMESUPPORT_THEMESUPPORT_CONFIGURATIONWIDGET_H
119 |
--------------------------------------------------------------------------------
/src/ThemeSupportConfigurationWidget.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget
4 |
5 |
6 |
7 | 0
8 | 0
9 | 400
10 | 300
11 |
12 |
13 |
14 | ThemeSupportConfigurationWidget
15 |
16 |
17 | -
18 |
19 |
20 | QFormLayout::FieldsStayAtSizeHint
21 |
22 |
-
23 |
24 |
25 | Theme:
26 |
27 |
28 |
29 | -
30 |
31 |
32 |
33 | 200
34 | 0
35 |
36 |
37 |
38 |
39 | 0
40 | 0
41 |
42 |
43 |
44 |
45 |
46 |
47 | -
48 |
49 |
50 | Qt::Vertical
51 |
52 |
53 |
54 | 20
55 | 40
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/src/ThemeSupportConfigurationWidget_linux.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 17/05/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #include "ThemeSupportConfigurationWidget.h"
25 |
26 | #include "ThemeSupport.h"
27 |
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 |
35 | auto Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget::addPlatformOptions(QFormLayout *layout) -> void {
36 | QSettings settings;
37 |
38 | m_themeComboBox = new QComboBox;
39 |
40 | auto styles = QStyleFactory::keys();
41 |
42 | for (auto style : styles) {
43 | m_themeComboBox->addItem(style);
44 | }
45 |
46 | layout->addRow("Style", m_themeComboBox);
47 |
48 | auto platformStyle = settings.value("ThemeSupport/Style","Fusion").toString();
49 |
50 | auto index = m_themeComboBox->findText(platformStyle);
51 |
52 | if (index>=0) {
53 | m_themeComboBox->blockSignals(true);
54 | m_themeComboBox->setCurrentIndex(index);
55 | m_themeComboBox->blockSignals(false);
56 | }
57 |
58 | connect(
59 | m_themeComboBox,
60 | qOverload(&QComboBox::currentIndexChanged),
61 | [=](const QString &text) {
62 |
63 | Q_EMIT settingsChanged();
64 | }
65 | );
66 | }
67 |
68 | auto Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget::applyPlatformOptions() -> void {
69 | QSettings settings;
70 |
71 | qApp->setStyle(m_themeComboBox->currentText());
72 |
73 | settings.setValue("ThemeSupport/Style",m_themeComboBox->currentText());
74 | }
--------------------------------------------------------------------------------
/src/ThemeSupportConfigurationWidget_mac.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 17/05/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #include "ThemeSupportConfigurationWidget.h"
25 |
26 | #include "ThemeSupport.h"
27 |
28 | auto Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget::addPlatformOptions(QFormLayout *layout) -> void {
29 |
30 | }
31 |
32 | auto Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget::applyPlatformOptions() -> void {
33 |
34 | }
--------------------------------------------------------------------------------
/src/ThemeSupportConfigurationWidget_windows.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 17/05/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #include "ThemeSupportConfigurationWidget.h"
25 |
26 | #include "ThemeSupport.h"
27 |
28 | auto Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget::addPlatformOptions(QFormLayout *layout) -> void {
29 |
30 | }
31 |
32 | auto Nedrysoft::ThemeSupport::ThemeSupportConfigurationWidget::applyPlatformOptions() -> void {
33 |
34 | }
--------------------------------------------------------------------------------
/src/ThemeSupportSpec.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 19/05/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #ifndef NEDRYSOFT_THEMESUPPORT_THEMESUPPORTSPEC_H
25 | #define NEDRYSOFT_THEMESUPPORT_THEMESUPPORTSPEC_H
26 |
27 | #if defined(NEDRYSOFT_LIBRARY_THEMESUPPORT_EXPORT)
28 | #define NEDRYSOFT_THEMESUPPORT_DLLSPEC Q_DECL_EXPORT
29 | #else
30 | #define NEDRYSOFT_THEMESUPPORT_DLLSPEC Q_DECL_IMPORT
31 | #endif
32 |
33 | #endif // NEDRYSOFT_THEMESUPPORT_THEMESUPPORTSPEC_H
34 |
--------------------------------------------------------------------------------
/src/ThemeSupport_linux.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Adrian Carpenter
3 | *
4 | * This file is part of the Nedrysoft Ribbon Bar. (https://github.com/nedrysoft/qt-ribbon)
5 | *
6 | * A cross-platform ribbon bar for Qt applications.
7 | *
8 | * Created by Adrian Carpenter on 31/03/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #include "ThemeSupport.h"
25 |
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 |
34 | auto Nedrysoft::ThemeSupport::ThemeSupport::isDarkMode() -> bool {
35 | if (m_activeTheme==Nedrysoft::ThemeSupport::Theme::System) {
36 | auto currentSystemMode = systemMode();
37 |
38 | if (currentSystemMode!=Nedrysoft::ThemeSupport::SystemMode::Unsupported) {
39 | return currentSystemMode==Nedrysoft::ThemeSupport::SystemMode::Dark;
40 | }
41 |
42 | // fallback, we compare the lightness of the text colour to the window background colour
43 |
44 | auto textLightness = QApplication::palette().text().color().lightnessF();
45 | auto backgroundLightness = QApplication::palette().window().color().lightnessF();
46 |
47 | if (textLightness > backgroundLightness) {
48 | return true;
49 | }
50 |
51 | return false;
52 | }
53 |
54 | return m_activeTheme==Nedrysoft::ThemeSupport::Theme::Dark;
55 | }
56 |
57 | auto Nedrysoft::ThemeSupport::ThemeSupport::getHighlightedBackground() -> QColor {
58 | return qobject_cast(QCoreApplication::instance())->style()->standardPalette().color(QPalette::Highlight);
59 | }
60 |
61 | auto Nedrysoft::ThemeSupport::ThemeSupport::initialisePlatform(bool beforeApplicationInstantiated) -> bool {
62 | QSettings settings;
63 |
64 | if (!beforeApplicationInstantiated) {
65 | auto style = settings.value("ThemeSupport/Style","Fusion").toString();
66 |
67 | qApp->setStyle(style);
68 |
69 | if (settings.value("ThemeSupport/Override", false).toBool()) {
70 | auto platformTheme = settings.value("ThemeSupport/Environment/QT_QPA_PLATFORMTHEME");
71 | auto styleOverride = settings.value("ThemeSupport/Environment/QT_STYLE_OVERRIDE");
72 |
73 | //qputenv("QT_QPA_PLATFORMTHEME", platformTheme.toByteArray());
74 | //qputenv("QT_STYLE_OVERRIDE", styleOverride.toByteArray());
75 | }
76 | }
77 |
78 | return true;
79 | }
80 |
81 | auto Nedrysoft::ThemeSupport::ThemeSupport::systemMode() -> Nedrysoft::ThemeSupport::SystemMode {
82 | typedef void *(_gtk_settings_get_default)();
83 | typedef void *(_g_object_get)(void *, const char *, ...);
84 | typedef void (_g_free)(void *);
85 |
86 | // try to load libgtk and get settings, if we are running under a gtk then the settings can be read.
87 |
88 | _g_object_get *g_object_get =
89 | (_g_object_get *) QLibrary::resolve("libgobject-2.0", "g_object_get");
90 |
91 | _gtk_settings_get_default *gtk_settings_get_default =
92 | (_gtk_settings_get_default *) QLibrary::resolve(
93 | "libgtk-x11-2.0",
94 | "gtk_settings_get_default"
95 | );
96 |
97 | _g_free *g_free =
98 | (_g_free *) QLibrary::resolve("glib-2.0", "g_free");
99 |
100 | if (( g_object_get ) && ( gtk_settings_get_default ) && ( g_free )) {
101 | void *settings = gtk_settings_get_default();
102 |
103 | if (settings) {
104 | char *propertyValue = nullptr;
105 |
106 | g_object_get(settings, "gtk-theme-name", &propertyValue, nullptr);
107 |
108 | if (propertyValue) {
109 | QString resultString = QString::fromUtf8(propertyValue);
110 |
111 | g_free(propertyValue);
112 |
113 | if (resultString.endsWith("-dark", Qt::CaseInsensitive)) {
114 | return Nedrysoft::ThemeSupport::SystemMode::Dark;
115 | }
116 |
117 | return Nedrysoft::ThemeSupport::SystemMode::Light;
118 | }
119 | }
120 | }
121 |
122 | return Nedrysoft::ThemeSupport::SystemMode::Unsupported;
123 | }
124 |
--------------------------------------------------------------------------------
/src/ThemeSupport_mac.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Adrian Carpenter
3 | *
4 | * This file is part of the Nedrysoft Ribbon Bar. (https://github.com/nedrysoft/qt-ribbon)
5 | *
6 | * A cross-platform ribbon bar for Qt applications.
7 | *
8 | * Created by Adrian Carpenter on 31/03/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #include "ThemeSupport.h"
25 |
26 | #include
27 |
28 | #import
29 | #import
30 |
31 | auto Nedrysoft::ThemeSupport::ThemeSupport::isDarkMode() -> bool {
32 | if (m_activeTheme==Nedrysoft::ThemeSupport::Theme::System) {
33 | return systemMode()==Nedrysoft::ThemeSupport::SystemMode::Dark;
34 | }
35 |
36 | return m_activeTheme==Nedrysoft::ThemeSupport::Theme::Dark;
37 | }
38 |
39 | auto Nedrysoft::ThemeSupport::ThemeSupport::systemMode() -> Nedrysoft::ThemeSupport::SystemMode {
40 | if (@available(macOS 10.14, *)) {
41 | NSAppearance *appearance = nullptr;
42 |
43 | if (@available(macOS 11, *)) {
44 | appearance = NSAppearance.currentDrawingAppearance;
45 | } else if (@available(macOS 10.14, *)) {
46 | #pragma clang diagnostic push
47 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
48 | appearance = NSAppearance.currentAppearance;
49 | #pragma clang diagnostic pop
50 | }
51 |
52 | NSAppearanceName basicAppearance = [appearance bestMatchFromAppearancesWithNames:@[
53 | NSAppearanceNameAqua,
54 | NSAppearanceNameDarkAqua
55 | ]];
56 |
57 | if ([basicAppearance isEqualToString:NSAppearanceNameDarkAqua] == YES) {
58 | return Nedrysoft::ThemeSupport::SystemMode::Dark;
59 | }
60 |
61 | return Nedrysoft::ThemeSupport::SystemMode::Light;
62 | }
63 |
64 | return Nedrysoft::ThemeSupport::SystemMode::Unsupported;
65 | }
66 |
67 | auto Nedrysoft::ThemeSupport::ThemeSupport::getHighlightedBackground() -> QColor {
68 | CGColorRef a = [NSColor systemBlueColor].CGColor;
69 |
70 | const CGFloat *color = CGColorGetComponents(a);
71 |
72 | return QColor::fromRgbF(color[0], color[1], color[2]);
73 | }
74 |
75 | auto Nedrysoft::ThemeSupport::ThemeSupport::initialisePlatform(bool beforeApplicationInstantiated) -> bool {
76 | return true;
77 | }
78 |
--------------------------------------------------------------------------------
/src/ThemeSupport_windows.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Adrian Carpenter
3 | *
4 | * This file is part of the Nedrysoft Ribbon Bar. (https://github.com/nedrysoft/qt-ribbon)
5 | *
6 | * A cross-platform ribbon bar for Qt applications.
7 | *
8 | * Created by Adrian Carpenter on 31/03/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | #include "ThemeSupport.h"
25 |
26 | #include
27 | #include
28 |
29 | auto Nedrysoft::ThemeSupport::ThemeSupport::isDarkMode() -> bool {
30 | if (m_activeTheme==Nedrysoft::ThemeSupport::Theme::System) {
31 | auto textLightness = QApplication::palette().text().color().lightnessF();
32 | auto backgroundLightness = QApplication::palette().window().color().lightnessF();
33 |
34 | if (textLightness > backgroundLightness) {
35 | return true;
36 | }
37 |
38 | return false;
39 | }
40 |
41 | return m_activeTheme==Nedrysoft::ThemeSupport::Theme::Dark;
42 | }
43 |
44 | auto Nedrysoft::ThemeSupport::ThemeSupport::getHighlightedBackground() -> QColor {
45 | return qobject_cast(QCoreApplication::instance())->style()->standardPalette().color(QPalette::Highlight);
46 | }
47 |
48 | auto Nedrysoft::ThemeSupport::ThemeSupport::systemMode() -> Nedrysoft::ThemeSupport::SystemMode {
49 | return Nedrysoft::ThemeSupport::SystemMode::Unsupported;
50 | }
51 |
52 | auto Nedrysoft::ThemeSupport::ThemeSupport::initialisePlatform(bool beforeApplicationInstantiated) -> bool {
53 | return true;
54 | }
55 |
--------------------------------------------------------------------------------
/src/Version.h.in:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Adrian Carpenter
3 | *
4 | * Created by Adrian Carpenter on 11/02/2021.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #if !defined(NEDRYSOFT_RC_VERSION_HEADER)
21 | #define NEDRYSOFT_LIB_VERSION @NEDRYSOFT_LIB_GIT_YEAR@, @NEDRYSOFT_LIB_GIT_MONTH@, @NEDRYSOFT_LIB_GIT_DAY@
22 | #define NEDRYSOFT_LIB_VERSION_STRING "@NEDRYSOFT_LIB_GIT_YEAR@.@NEDRYSOFT_LIB_GIT_MONTH@.@NEDRYSOFT_LIB_GIT_DAY@\0"
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/resources.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | ../themes/macos_dark.palette
4 | ../themes/macos_dark.qss
5 | ../themes/macos_light.palette
6 |
7 | ../themes/windows_dark.palette
8 | ../themes/windows_dark.qss
9 | ../themes/windows_light.palette
10 |
11 | ../themes/linux_dark.palette
12 | ../themes/linux_dark.qss
13 | ../themes/linux_light.palette
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/version.rc:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Adrian Carpenter
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include
19 | #include "Version.h"
20 |
21 | #if !defined(VER_COMPANYNAME_STR)
22 | #define VER_COMPANYNAME_STR "nedrysoft.com"
23 | #endif
24 |
25 | #if !defined(VER_FILEDESCRIPTION_STR)
26 | #define VER_FILEDESCRIPTION_STR NEDRYSOFT_MODULE_NAME
27 | #endif
28 |
29 | #if !defined(VER_LEGALCOPYRIGHT_STR)
30 | #define VER_LEGALCOPYRIGHT_STR "Copyright (C) 2020 Adrian Carpenter"
31 | #endif
32 |
33 | #if !defined(VER_ORIGINALFILENAME_STR)
34 | #define VER_ORIGINALFILENAME_STR NEDRYSOFT_MODULE_FILENAME
35 | #endif
36 |
37 | #if !defined(VER_PRODUCTNAME_STR)
38 | #define VER_PRODUCTNAME_STR NEDRYSOFT_MODULE_NAME
39 | #endif
40 |
41 | #if !defined(VER_FILEVERSION)
42 | #define VER_FILEVERSION NEDRYSOFT_LIB_VERSION
43 | #endif
44 |
45 | #if !defined(VER_FILEVERSION_STR)
46 | #define VER_FILEVERSION_STR NEDRYSOFT_LIB_VERSION_STRING
47 | #endif
48 |
49 | #if !defined(VER_PRODUCTVERSION)
50 | #define VER_PRODUCTVERSION NEDRYSOFT_LIB_VERSION
51 | #endif
52 |
53 | #if !defined(VER_PRODUCTVERSION_STR)
54 | #define VER_PRODUCTVERSION_STR NEDRYSOFT_LIB_VERSION_STRING
55 | #endif
56 |
57 | #ifndef DEBUG
58 | #define VER_DEBUG 0
59 | #else
60 | #define VER_DEBUG VS_FF_DEBUG
61 | #endif
62 |
63 | VS_VERSION_INFO VERSIONINFO
64 | FILEVERSION VER_FILEVERSION
65 | PRODUCTVERSION VER_PRODUCTVERSION
66 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
67 | //FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
68 | FILEOS VOS__WINDOWS32
69 | FILETYPE VFT_DLL
70 | FILESUBTYPE VFT2_UNKNOWN
71 | BEGIN
72 | BLOCK
73 | "StringFileInfo"
74 | BEGIN
75 | BLOCK
76 | "040904E4"
77 | BEGIN
78 | VALUE
79 | "CompanyName", VER_COMPANYNAME_STR
80 | VALUE "FileDescription", VER_FILEDESCRIPTION_STR
81 | VALUE "FileVersion", VER_FILEVERSION_STR
82 | VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
83 | VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
84 | VALUE "ProductName", VER_PRODUCTNAME_STR
85 | VALUE "ProductVersion", VER_PRODUCTVERSION_STR
86 | END
87 | END
88 |
89 | BLOCK "VarFileInfo"
90 | BEGIN
91 | /* The following line should only be modified for localized versions. */
92 | /* It consists of any number of WORD,WORD pairs, with each pair */
93 | /* describing a language,codepage combination supported by the file. */
94 | /* */
95 | /* For example, a file might have values "0x409,1252" indicating that it */
96 | /* supports English language (0x409) in the Windows ANSI codepage (1252). */
97 |
98 | VALUE
99 | "Translation", 0x809, 1252
100 | END
101 | END
102 |
--------------------------------------------------------------------------------
/themes/linux_dark.palette:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2021 Adrian Carpenter
3 | #
4 | # This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | #
6 | # An open-source cross-platform traceroute analyser.
7 | #
8 | # Created by Adrian Carpenter on 16/05/2021.
9 | #
10 | # This program is free software: you can redistribute it and/or modify
11 | # it under the terms of the GNU General Public License as published by
12 | # the Free Software Foundation, either version 3 of the License, or
13 | # (at your option) any later version.
14 | #
15 | # This program is distributed in the hope that it will be useful,
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | # GNU General Public License for more details.
19 | #
20 | # You should have received a copy of the GNU General Public License
21 | # along with this program. If not, see .
22 | #
23 |
24 | #
25 | # It may not be enough to just set the palette for forcing a theme, we may also need to set up a stylesheet which
26 | # further modifies the styles on an element by element basis.
27 | #
28 |
29 | [Active]
30 | AlternateBase=#ff989898
31 | Base=#ff1e1e1e
32 | BrightText=#ff373737
33 | Button=#656565
34 | ButtonText=#ffffffff
35 | Dark=#ffbfbfbf
36 | Highlight=#ff3f638b
37 | HighlightedText=#d8ffffff
38 | Light=#ff373737
39 | Link=#d8ffffff
40 | LinkVisited=#d8ffffff
41 | Mid=#ff242424
42 | Midlight=#ff343434
43 | PlaceholderText=#80ffffff
44 | Shadow=#ff000000
45 | Text=#d8ffffff
46 | ToolTipBase=#3fffffff
47 | ToolTipText=#ff000000
48 | Window=#202421
49 | WindowText=#d8ffffff
50 |
51 | [Disabled]
52 | AlternateBase=#ff989898
53 | Base=#ff323232
54 | BrightText=#ff373737
55 | Button=#656565
56 | ButtonText=#ff1f1f1f
57 | Dark=#ffbfbfbf
58 | Highlight=#ff464646
59 | HighlightedText=#3fffffff
60 | Light=#ff373737
61 | Link=#3fffffff
62 | LinkVisited=#3fffffff
63 | Mid=#ff242424
64 | Midlight=#ff343434
65 | PlaceholderText=#80ffffff
66 | Shadow=#ff000000
67 | Text=#3fffffff
68 | ToolTipBase=#3fffffff
69 | ToolTipText=#ff000000
70 | Window=#202421
71 | WindowText=#3fffffff
72 |
73 | [Inactive]
74 | AlternateBase=#ff989898
75 | Base=#ff1e1e1e
76 | BrightText=#ff373737
77 | Button=#656565
78 | ButtonText=#ff000000
79 | Dark=#ffbfbfbf
80 | Highlight=#ff464646
81 | HighlightedText=#d8ffffff
82 | Light=#ff373737
83 | Link=#d8ffffff
84 | LinkVisited=#d8ffffff
85 | Mid=#ff242424
86 | Midlight=#ff343434
87 | PlaceholderText=#80ffffff
88 | Shadow=#ff000000
89 | Text=#d8ffffff
90 | ToolTipBase=#3fffffff
91 | ToolTipText=#ff000000
92 | Window=#202421
93 | WindowText=#d8ffffff
94 |
95 | [Normal]
96 | AlternateBase=#ff989898
97 | Base=#ff1e1e1e
98 | BrightText=#ff434343
99 | Button=#ff656565
100 | ButtonText=#ff000000
101 | Dark=#ffbfbfbf
102 | Highlight=#ff3f638b
103 | HighlightedText=#d8ffffff
104 | Light=#ff373737
105 | Link=#d8ffffff
106 | LinkVisited=#d8ffffff
107 | Mid=#ff242424
108 | Midlight=#ff343434
109 | PlaceholderText=#80ffffff
110 | Shadow=#ff000000
111 | Text=#d8ffffff
112 | ToolTipBase=#3fffffff
113 | ToolTipText=#ff000000
114 | Window=#202421
115 | WindowText=#d8ffffff
116 |
--------------------------------------------------------------------------------
/themes/linux_dark.qss:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 16/05/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | /*
25 | * It may not be enough to just set the palette for forcing a theme, we may also need to set up a stylesheet which
26 | * further modifies the styles on an element by element basis.
27 | */
28 |
29 | QPushButton {
30 | background-color: /*Button.Normal*/;
31 | color: /*ButtonText.Active*/;
32 |
33 | padding-left: 12px;
34 | padding-top: 3px;
35 | padding-right: 12px;
36 | padding-bottom: 3px;
37 | outline: none;
38 | border: none;
39 | }
40 |
41 | QPushButton:hover {
42 | background-color: #4c4c4c;
43 | }
44 |
45 | QPushButton:disabled {
46 | background-color: /*Button.Disabled*/;
47 | color: /*ButtonText.Disabled*/;
48 | }
49 |
50 | QMenu::item {
51 | color: /*Text*/;
52 | }
53 |
54 | QMenu::item:disabled {
55 | color: #757578;
56 | }
57 |
58 | QComboBox {
59 | background-color: /*Base*/;
60 | color: /*Text.Active*/;
61 | }
62 |
63 | QComboBox::item {
64 | color: /*Text.Active*/;
65 | }
66 |
67 | QComboBox::item:disabled {
68 | color: /*Text.Disabled*/
69 | }
70 |
71 | QComboBox::drop-down {
72 | color: /*Text.Active*/;
73 | background: /*Base*/;
74 | }
75 |
76 | QLineEdit {
77 | border: none;
78 | border-bottom: 1px solid #494949;
79 | }
80 |
81 | QHeaderView::section {
82 | background-color: /*Window*/;
83 | color: /*Text*/;
84 | }
85 |
86 | QHeaderView::section:horizontal {
87 | border: 0px;
88 | border-right: 1px solid #BFBFBF;
89 | }
90 |
91 | QHeaderView::section:horizontal:only-one {
92 | border: 0px;
93 | }
94 |
95 | QMenu {
96 | background:#191819;
97 | }
98 |
99 | QMenu::item::selected {
100 | background:#303030;
101 | }
102 |
103 | QMenu::item::selected:disabled {
104 | background: none;
105 | }
106 |
107 | QMenuBar {
108 | background: /*Window.Normal*/;
109 | color: /*WindowText.Normal*/;
110 | }
111 |
112 | QMenuBar::item:selected {
113 | background:#191819;
114 | }
115 |
116 |
--------------------------------------------------------------------------------
/themes/linux_light.palette:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2021 Adrian Carpenter
3 | #
4 | # This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | #
6 | # An open-source cross-platform traceroute analyser.
7 | #
8 | # Created by Adrian Carpenter on 16/05/2021.
9 | #
10 | # This program is free software: you can redistribute it and/or modify
11 | # it under the terms of the GNU General Public License as published by
12 | # the Free Software Foundation, either version 3 of the License, or
13 | # (at your option) any later version.
14 | #
15 | # This program is distributed in the hope that it will be useful,
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | # GNU General Public License for more details.
19 | #
20 | # You should have received a copy of the GNU General Public License
21 | # along with this program. If not, see .
22 | #
23 |
24 | #
25 | # It may not be enough to just set the palette for forcing a theme, we may also need to set up a stylesheet which
26 | # further modifies the styles on an element by element basis.
27 | #
28 |
29 | [Active]
30 | AlternateBase=#fff5f5f5
31 | Base=#ffffffff
32 | BrightText=#ffffffff
33 | Button=#fff0f0f0
34 | ButtonText=#ff000000
35 | Dark=#ffa0a0a0
36 | Highlight=#ff0078d7
37 | HighlightedText=#ffffffff
38 | Light=#ffffffff
39 | Link=#ff000000
40 | LinkVisited=#ff000000
41 | Mid=#ffa0a0a0
42 | Midlight=#ffe3e3e3
43 | PlaceholderText=#80000000
44 | Shadow=#ff696969
45 | Text=#ff000000
46 | ToolTipBase=#ffffffdc
47 | ToolTipText=#ff000000
48 | Window=#fff0f0f0
49 | WindowText=#ff000000
50 |
51 | [Disabled]
52 | AlternateBase=#fff5f5f5
53 | Base=#fff0f0f0
54 | BrightText=#ffffffff
55 | Button=#fff0f0f0
56 | ButtonText=#ff787878
57 | Dark=#ffa0a0a0
58 | Highlight=#ff0078d7
59 | HighlightedText=#ffffffff
60 | Light=#ffffffff
61 | Link=#ff787878
62 | LinkVisited=#ff787878
63 | Mid=#ffa0a0a0
64 | Midlight=#fff7f7f7
65 | PlaceholderText=#80000000
66 | Shadow=#ff000000
67 | Text=#ff787878
68 | ToolTipBase=#ffffffdc
69 | ToolTipText=#ff000000
70 | Window=#fff0f0f0
71 | WindowText=#ff787878
72 |
73 | [Inactive]
74 | AlternateBase=#fff5f5f5
75 | Base=#ffffffff
76 | BrightText=#ffffffff
77 | Button=#fff0f0f0
78 | ButtonText=#ff000000
79 | Dark=#ffa0a0a0
80 | Highlight=#fff0f0f0
81 | HighlightedText=#ff000000
82 | Light=#ffffffff
83 | Link=#ff000000
84 | LinkVisited=#ff000000
85 | Mid=#ffa0a0a0
86 | Midlight=#ffe3e3e3
87 | PlaceholderText=#80000000
88 | Shadow=#ff696969
89 | Text=#ff000000
90 | ToolTipBase=#ffffffdc
91 | ToolTipText=#ff000000
92 | Window=#fff0f0f0
93 | WindowText=#ff000000
94 |
95 | [Normal]
96 | AlternateBase=#fff5f5f5
97 | Base=#ffffffff
98 | BrightText=#ffffffff
99 | Button=#fff0f0f0
100 | ButtonText=#ff000000
101 | Dark=#ffa0a0a0
102 | Highlight=#ff0078d7
103 | HighlightedText=#ffffffff
104 | Light=#ffffffff
105 | Link=#ff000000
106 | LinkVisited=#ff000000
107 | Mid=#ffa0a0a0
108 | Midlight=#ffe3e3e3
109 | PlaceholderText=#80000000
110 | Shadow=#ff696969
111 | Text=#ff000000
112 | ToolTipBase=#ffffffdc
113 | ToolTipText=#ff000000
114 | Window=#fff0f0f0
115 | WindowText=#ff000000
116 |
--------------------------------------------------------------------------------
/themes/macos_dark.palette:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2021 Adrian Carpenter
3 | #
4 | # This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | #
6 | # An open-source cross-platform traceroute analyser.
7 | #
8 | # Created by Adrian Carpenter on 16/05/2021.
9 | #
10 | # This program is free software: you can redistribute it and/or modify
11 | # it under the terms of the GNU General Public License as published by
12 | # the Free Software Foundation, either version 3 of the License, or
13 | # (at your option) any later version.
14 | #
15 | # This program is distributed in the hope that it will be useful,
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | # GNU General Public License for more details.
19 | #
20 | # You should have received a copy of the GNU General Public License
21 | # along with this program. If not, see .
22 | #
23 |
24 | #
25 | # It may not be enough to just set the palette for forcing a theme, we may also need to set up a stylesheet which
26 | # further modifies the styles on an element by element basis.
27 | #
28 |
29 | [Active]
30 | AlternateBase=#ff989898
31 | Base=#ff1e1e1e
32 | BrightText=#ff373737
33 | Button=#656565
34 | ButtonText=#ffffffff
35 | Dark=#ffbfbfbf
36 | Highlight=#ff3f638b
37 | HighlightedText=#d8ffffff
38 | Light=#ff373737
39 | Link=#d8ffffff
40 | LinkVisited=#d8ffffff
41 | Mid=#ff242424
42 | Midlight=#ff343434
43 | PlaceholderText=#80ffffff
44 | Shadow=#ff000000
45 | Text=#d8ffffff
46 | ToolTipBase=#3fffffff
47 | ToolTipText=#ff000000
48 | Window=#ff323232
49 | WindowText=#d8ffffff
50 |
51 | [Disabled]
52 | AlternateBase=#ff989898
53 | Base=#ff323232
54 | BrightText=#ff373737
55 | Button=#656565
56 | ButtonText=#ff1f1f1f
57 | Dark=#ffbfbfbf
58 | Highlight=#ff464646
59 | HighlightedText=#3fffffff
60 | Light=#ff373737
61 | Link=#3fffffff
62 | LinkVisited=#3fffffff
63 | Mid=#ff242424
64 | Midlight=#ff343434
65 | PlaceholderText=#80ffffff
66 | Shadow=#ff000000
67 | Text=#3fffffff
68 | ToolTipBase=#3fffffff
69 | ToolTipText=#ff000000
70 | Window=#ff323232
71 | WindowText=#3fffffff
72 |
73 | [Inactive]
74 | AlternateBase=#ff989898
75 | Base=#ff1e1e1e
76 | BrightText=#ff373737
77 | Button=#656565
78 | ButtonText=#ff000000
79 | Dark=#ffbfbfbf
80 | Highlight=#ff464646
81 | HighlightedText=#d8ffffff
82 | Light=#ff373737
83 | Link=#d8ffffff
84 | LinkVisited=#d8ffffff
85 | Mid=#ff242424
86 | Midlight=#ff343434
87 | PlaceholderText=#80ffffff
88 | Shadow=#ff000000
89 | Text=#d8ffffff
90 | ToolTipBase=#3fffffff
91 | ToolTipText=#ff000000
92 | Window=#ff323232
93 | WindowText=#d8ffffff
94 |
95 | [Normal]
96 | AlternateBase=#ff989898
97 | Base=#ff1e1e1e
98 | BrightText=#ff434343
99 | Button=#ff656565
100 | ButtonText=#ff000000
101 | Dark=#ffbfbfbf
102 | Highlight=#ff3f638b
103 | HighlightedText=#d8ffffff
104 | Light=#ff373737
105 | Link=#d8ffffff
106 | LinkVisited=#d8ffffff
107 | Mid=#ff242424
108 | Midlight=#ff343434
109 | PlaceholderText=#80ffffff
110 | Shadow=#ff000000
111 | Text=#d8ffffff
112 | ToolTipBase=#3fffffff
113 | ToolTipText=#ff000000
114 | Window=#ff323232
115 | WindowText=#d8ffffff
116 |
--------------------------------------------------------------------------------
/themes/macos_dark.qss:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 16/05/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | /*
25 | * It may not be enough to just set the palette for forcing a theme, we may also need to set up a stylesheet which
26 | * further modifies the styles on an element by element basis.
27 | */
28 |
29 | QPushButton {
30 | background-color: /*Button.Normal*/;
31 | color: /*ButtonText.Active*/;
32 |
33 | border-radius: 6px;
34 | padding-left: 12px;
35 | padding-top: 3px;
36 | padding-right: 12px;
37 | padding-bottom: 3px;
38 | outline: none;
39 | border: none;
40 | }
41 |
42 | QMenu::item {
43 | color: /*Text*/;
44 | }
45 |
46 | QMenu::item:disabled {
47 | color: #757578;
48 | }
49 |
50 | QComboBox {
51 | background-color: /*Base*/;
52 | }
53 |
54 | QComboBox::item {
55 | color: /*Text.Active*/;
56 | }
57 |
58 | QComboBox::item:disabled {
59 | color: #757578;
60 | }
61 |
62 | QLineEdit {
63 | border: none;
64 | border-bottom: 1px solid #494949;
65 | }
66 |
67 | QHeaderView::section {
68 | background-color: /*Window*/;
69 | color: /*Text*/;
70 | }
71 |
72 | QHeaderView::section:horizontal {
73 | border: 0px;
74 | border-right: 1px solid #BFBFBF;
75 | }
76 |
77 | QHeaderView::section:horizontal:only-one {
78 | border: 0px;
79 | }
--------------------------------------------------------------------------------
/themes/macos_light.palette:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2021 Adrian Carpenter
3 | #
4 | # This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | #
6 | # An open-source cross-platform traceroute analyser.
7 | #
8 | # Created by Adrian Carpenter on 16/05/2021.
9 | #
10 | # This program is free software: you can redistribute it and/or modify
11 | # it under the terms of the GNU General Public License as published by
12 | # the Free Software Foundation, either version 3 of the License, or
13 | # (at your option) any later version.
14 | #
15 | # This program is distributed in the hope that it will be useful,
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | # GNU General Public License for more details.
19 | #
20 | # You should have received a copy of the GNU General Public License
21 | # along with this program. If not, see .
22 | #
23 |
24 | #
25 | # It may not be enough to just set the palette for forcing a theme, we may also need to set up a stylesheet which
26 | # further modifies the styles on an element by element basis.
27 | #
28 |
29 | [Active]
30 | AlternateBase=#fff5f5f5
31 | Base=#ffffffff
32 | BrightText=#ffffffff
33 | Button=#ffececec
34 | ButtonText=#ff000000
35 | Dark=#ffbfbfbf
36 | Highlight=#ffb3d7ff
37 | HighlightedText=#d8000000
38 | Light=#ffffffff
39 | Link=#d8000000
40 | LinkVisited=#d8000000
41 | Mid=#ffa9a9a9
42 | Midlight=#fff5f5f5
43 | PlaceholderText=#80000000
44 | Shadow=#ff000000
45 | Text=#d8000000
46 | ToolTipBase=#ffffffff
47 | ToolTipText=#ff000000
48 | Window=#ffececec
49 | WindowText=#d8000000
50 |
51 | [Disabled]
52 | AlternateBase=#fff5f5f5
53 | Base=#ffececec
54 | BrightText=#ffffffff
55 | Button=#ffececec
56 | ButtonText=#ff939393
57 | Dark=#ffbfbfbf
58 | Highlight=#ffdcdcdc
59 | HighlightedText=#3f000000
60 | Light=#ffffffff
61 | Link=#3f000000
62 | LinkVisited=#3f000000
63 | Mid=#ffa9a9a9
64 | Midlight=#fff5f5f5
65 | PlaceholderText=#80000000
66 | Shadow=#ff000000
67 | Text=#3f000000
68 | ToolTipBase=#ffffffff
69 | ToolTipText=#ff000000
70 | Window=#ffececec
71 | WindowText=#3f000000
72 |
73 | [Inactive]
74 | AlternateBase=#fff5f5f5
75 | Base=#ffffffff
76 | BrightText=#ffffffff
77 | Button=#ffececec
78 | ButtonText=#ff000000
79 | Dark=#ffbfbfbf
80 | Highlight=#ffdcdcdc
81 | HighlightedText=#d8000000
82 | Light=#ffffffff
83 | Link=#d8000000
84 | LinkVisited=#d8000000
85 | Mid=#ffa9a9a9
86 | Midlight=#fff5f5f5
87 | PlaceholderText=#80000000
88 | Shadow=#ff000000
89 | Text=#d8000000
90 | ToolTipBase=#ffffffff
91 | ToolTipText=#ff000000
92 | Window=#ffececec
93 | WindowText=#d8000000
94 |
95 | [Normal]
96 | AlternateBase=#fff5f5f5
97 | Base=#ffffffff
98 | BrightText=#ffffffff
99 | Button=#ffececec
100 | ButtonText=#ff000000
101 | Dark=#ffbfbfbf
102 | Highlight=#ffb3d7ff
103 | HighlightedText=#d8000000
104 | Light=#ffffffff
105 | Link=#d8000000
106 | LinkVisited=#d8000000
107 | Mid=#ffa9a9a9
108 | Midlight=#fff5f5f5
109 | PlaceholderText=#80000000
110 | Shadow=#ff000000
111 | Text=#d8000000
112 | ToolTipBase=#ffffffff
113 | ToolTipText=#ff000000
114 | Window=#ffececec
115 | WindowText=#d8000000
116 |
--------------------------------------------------------------------------------
/themes/windows_dark.palette:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2021 Adrian Carpenter
3 | #
4 | # This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | #
6 | # An open-source cross-platform traceroute analyser.
7 | #
8 | # Created by Adrian Carpenter on 16/05/2021.
9 | #
10 | # This program is free software: you can redistribute it and/or modify
11 | # it under the terms of the GNU General Public License as published by
12 | # the Free Software Foundation, either version 3 of the License, or
13 | # (at your option) any later version.
14 | #
15 | # This program is distributed in the hope that it will be useful,
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | # GNU General Public License for more details.
19 | #
20 | # You should have received a copy of the GNU General Public License
21 | # along with this program. If not, see .
22 | #
23 |
24 | #
25 | # It may not be enough to just set the palette for forcing a theme, we may also need to set up a stylesheet which
26 | # further modifies the styles on an element by element basis.
27 | #
28 |
29 | [Active]
30 | AlternateBase=#ff989898
31 | Base=#ff1e1e1e
32 | BrightText=#ff373737
33 | Button=#656565
34 | ButtonText=#ffffffff
35 | Dark=#ffbfbfbf
36 | Highlight=#ff3f638b
37 | HighlightedText=#d8ffffff
38 | Light=#ff373737
39 | Link=#d8ffffff
40 | LinkVisited=#d8ffffff
41 | Mid=#ff242424
42 | Midlight=#ff343434
43 | PlaceholderText=#80ffffff
44 | Shadow=#ff000000
45 | Text=#d8ffffff
46 | ToolTipBase=#3fffffff
47 | ToolTipText=#ff000000
48 | Window=#202421
49 | WindowText=#d8ffffff
50 |
51 | [Disabled]
52 | AlternateBase=#ff989898
53 | Base=#ff323232
54 | BrightText=#ff373737
55 | Button=#656565
56 | ButtonText=#ff1f1f1f
57 | Dark=#ffbfbfbf
58 | Highlight=#ff464646
59 | HighlightedText=#3fffffff
60 | Light=#ff373737
61 | Link=#3fffffff
62 | LinkVisited=#3fffffff
63 | Mid=#ff242424
64 | Midlight=#ff343434
65 | PlaceholderText=#80ffffff
66 | Shadow=#ff000000
67 | Text=#3fffffff
68 | ToolTipBase=#3fffffff
69 | ToolTipText=#ff000000
70 | Window=#202421
71 | WindowText=#3fffffff
72 |
73 | [Inactive]
74 | AlternateBase=#ff989898
75 | Base=#ff1e1e1e
76 | BrightText=#ff373737
77 | Button=#656565
78 | ButtonText=#ff000000
79 | Dark=#ffbfbfbf
80 | Highlight=#ff464646
81 | HighlightedText=#d8ffffff
82 | Light=#ff373737
83 | Link=#d8ffffff
84 | LinkVisited=#d8ffffff
85 | Mid=#ff242424
86 | Midlight=#ff343434
87 | PlaceholderText=#80ffffff
88 | Shadow=#ff000000
89 | Text=#d8ffffff
90 | ToolTipBase=#3fffffff
91 | ToolTipText=#ff000000
92 | Window=#202421
93 | WindowText=#d8ffffff
94 |
95 | [Normal]
96 | AlternateBase=#ff989898
97 | Base=#ff1e1e1e
98 | BrightText=#ff434343
99 | Button=#ff656565
100 | ButtonText=#ff000000
101 | Dark=#ffbfbfbf
102 | Highlight=#ff3f638b
103 | HighlightedText=#d8ffffff
104 | Light=#ff373737
105 | Link=#d8ffffff
106 | LinkVisited=#d8ffffff
107 | Mid=#ff242424
108 | Midlight=#ff343434
109 | PlaceholderText=#80ffffff
110 | Shadow=#ff000000
111 | Text=#d8ffffff
112 | ToolTipBase=#3fffffff
113 | ToolTipText=#ff000000
114 | Window=#202421
115 | WindowText=#d8ffffff
116 |
--------------------------------------------------------------------------------
/themes/windows_dark.qss:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Adrian Carpenter
3 | *
4 | * This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | *
6 | * An open-source cross-platform traceroute analyser.
7 | *
8 | * Created by Adrian Carpenter on 16/05/2021.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation, either version 3 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program. If not, see .
22 | */
23 |
24 | /*
25 | * It may not be enough to just set the palette for forcing a theme, we may also need to set up a stylesheet which
26 | * further modifies the styles on an element by element basis.
27 | */
28 |
29 | QPushButton {
30 | background-color: /*Button.Normal*/;
31 | color: /*ButtonText.Active*/;
32 |
33 | padding-left: 12px;
34 | padding-top: 3px;
35 | padding-right: 12px;
36 | padding-bottom: 3px;
37 | outline: none;
38 | border: none;
39 | }
40 |
41 | QMenu::item {
42 | color: /*Text*/;
43 | }
44 |
45 | QMenu::item:disabled {
46 | color: #757578;
47 | }
48 |
49 | QComboBox {
50 | background-color: /*Base*/;
51 | }
52 |
53 | QComboBox::item {
54 | color: /*Text.Active*/;
55 | }
56 |
57 | QComboBox::item:disabled {
58 | color: #757578;
59 | }
60 |
61 | QComboBox::drop-down {
62 | color: white;
63 | background: #303030;
64 | }
65 |
66 | QLineEdit {
67 | border: none;
68 | border-bottom: 1px solid #494949;
69 | }
70 |
71 | QHeaderView::section {
72 | background-color: /*Window*/;
73 | color: /*Text*/;
74 | }
75 |
76 | QHeaderView::section:horizontal {
77 | border: 0px;
78 | border-right: 1px solid #BFBFBF;
79 | }
80 |
81 | QHeaderView::section:horizontal:only-one {
82 | border: 0px;
83 | }
84 |
85 | QMenu {
86 | background:#191819;
87 | }
88 |
89 | QMenu::item::selected {
90 | background:#303030;
91 | }
92 |
93 | QMenu::item::selected:disabled {
94 | background: none;
95 | }
96 |
97 | QMenuBar {
98 | background: /*Window.Normal*/;
99 | color: /*WindowText.Normal*/;
100 | }
101 |
102 | QMenuBar::item:selected {
103 | background:#191819;
104 | }
105 |
106 |
--------------------------------------------------------------------------------
/themes/windows_light.palette:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2021 Adrian Carpenter
3 | #
4 | # This file is part of Pingnoo (https://github.com/nedrysoft/pingnoo)
5 | #
6 | # An open-source cross-platform traceroute analyser.
7 | #
8 | # Created by Adrian Carpenter on 16/05/2021.
9 | #
10 | # This program is free software: you can redistribute it and/or modify
11 | # it under the terms of the GNU General Public License as published by
12 | # the Free Software Foundation, either version 3 of the License, or
13 | # (at your option) any later version.
14 | #
15 | # This program is distributed in the hope that it will be useful,
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | # GNU General Public License for more details.
19 | #
20 | # You should have received a copy of the GNU General Public License
21 | # along with this program. If not, see .
22 | #
23 |
24 | #
25 | # It may not be enough to just set the palette for forcing a theme, we may also need to set up a stylesheet which
26 | # further modifies the styles on an element by element basis.
27 | #
28 |
29 | [Active]
30 | AlternateBase=#fff5f5f5
31 | Base=#ffffffff
32 | BrightText=#ffffffff
33 | Button=#fff0f0f0
34 | ButtonText=#ff000000
35 | Dark=#ffa0a0a0
36 | Highlight=#ff0078d7
37 | HighlightedText=#ffffffff
38 | Light=#ffffffff
39 | Link=#ff000000
40 | LinkVisited=#ff000000
41 | Mid=#ffa0a0a0
42 | Midlight=#ffe3e3e3
43 | PlaceholderText=#80000000
44 | Shadow=#ff696969
45 | Text=#ff000000
46 | ToolTipBase=#ffffffdc
47 | ToolTipText=#ff000000
48 | Window=#fff0f0f0
49 | WindowText=#ff000000
50 |
51 | [Disabled]
52 | AlternateBase=#fff5f5f5
53 | Base=#fff0f0f0
54 | BrightText=#ffffffff
55 | Button=#fff0f0f0
56 | ButtonText=#ff787878
57 | Dark=#ffa0a0a0
58 | Highlight=#ff0078d7
59 | HighlightedText=#ffffffff
60 | Light=#ffffffff
61 | Link=#ff787878
62 | LinkVisited=#ff787878
63 | Mid=#ffa0a0a0
64 | Midlight=#fff7f7f7
65 | PlaceholderText=#80000000
66 | Shadow=#ff000000
67 | Text=#ff787878
68 | ToolTipBase=#ffffffdc
69 | ToolTipText=#ff000000
70 | Window=#fff0f0f0
71 | WindowText=#ff787878
72 |
73 | [Inactive]
74 | AlternateBase=#fff5f5f5
75 | Base=#ffffffff
76 | BrightText=#ffffffff
77 | Button=#fff0f0f0
78 | ButtonText=#ff000000
79 | Dark=#ffa0a0a0
80 | Highlight=#fff0f0f0
81 | HighlightedText=#ff000000
82 | Light=#ffffffff
83 | Link=#ff000000
84 | LinkVisited=#ff000000
85 | Mid=#ffa0a0a0
86 | Midlight=#ffe3e3e3
87 | PlaceholderText=#80000000
88 | Shadow=#ff696969
89 | Text=#ff000000
90 | ToolTipBase=#ffffffdc
91 | ToolTipText=#ff000000
92 | Window=#fff0f0f0
93 | WindowText=#ff000000
94 |
95 | [Normal]
96 | AlternateBase=#fff5f5f5
97 | Base=#ffffffff
98 | BrightText=#ffffffff
99 | Button=#fff0f0f0
100 | ButtonText=#ff000000
101 | Dark=#ffa0a0a0
102 | Highlight=#ff0078d7
103 | HighlightedText=#ffffffff
104 | Light=#ffffffff
105 | Link=#ff000000
106 | LinkVisited=#ff000000
107 | Mid=#ffa0a0a0
108 | Midlight=#ffe3e3e3
109 | PlaceholderText=#80000000
110 | Shadow=#ff696969
111 | Text=#ff000000
112 | ToolTipBase=#ffffffdc
113 | ToolTipText=#ff000000
114 | Window=#fff0f0f0
115 | WindowText=#ff000000
116 |
--------------------------------------------------------------------------------