1 /*
2    Drawpile - a collaborative drawing program.
3 
4    Copyright (C) 2014-2019 Calle Laakkonen
5 
6    Drawpile 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    Drawpile 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 Drawpile.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef ICON_H
21 #define ICON_H
22 
23 #include <QIcon>
24 
25 namespace icon {
26 
27 //! Check if a dark theme icon should be used on a background of this color
28 bool isDark(const QColor &color);
29 
30 //! Select whether to use the dark or light theme based on current palette
31 void selectThemeVariant();
32 
33 //! Did selectThemeVariant pick the dark theme?
34 bool isDarkThemeSelected();
35 
36 //! Get an icon from the system theme, falling back to the bundled icon set
fromTheme(const QString & name)37 inline QIcon fromTheme(const QString &name) {
38 	// Note: after we no longer support anything older thant Qt 5.11,
39 	// we can just use QIcon::fromTheme(name) and set a fallback search path
40 	return QIcon::fromTheme(name, QIcon(QStringLiteral("theme:") + name + QStringLiteral(".svg")));
41 }
42 
43 }
44 
45 #endif
46 
47