52 QColor
forMode(
bool isDarkMode)
const {
return isDarkMode ? dark : light; }
54 void setForMode(
bool isDarkMode,
const QColor &color) { (isDarkMode ? dark : light) = color; }
57 static bool sameColor(
const QColor &a,
const QColor &b) {
58 return a.isValid() == b.isValid() && (!a.isValid() || a.rgba() == b.rgba());
61 bool isValid()
const {
return light.isValid() && dark.isValid(); }
65 bool operator!=(
const ThemeColorPair &other)
const {
return !(*
this == other); }
81 bool operator!=(
const ThemeFontHint &other)
const {
return !(*
this == other); }
194 PacketsSelectionText,
205 ConversationClientText,
207 ConversationServerText,
228 FilterBookmarkDisplay,
229 FilterBookmarkCapture,
268 PaletteAlternateBase,
280 PaletteHighlightedText,
281#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
333 CardSectionHeaderHover,
337 OverlayCardBackground,
357 UpdateButtonDisabledBg,
358 UpdateButtonDisabledText,
359 UpdateDismissHoverBg,
360 UpdateDismissPressedBg,
364 HighlightColorOrange,
392 TextOnFilterDeprecated,
459 static void init(
const QString &theme = QString());
466 ThemeInfo
info()
const;
525 bool loadDraft(
const QString &internalName, ThemeDraft &out,
526 QString *errorString =
nullptr,
527 ThemeParseReport *report =
nullptr)
const;
540 bool parseDraft(
const QByteArray &jsonc,
const QString &internalName,
541 ThemeDraft &out, QString *errorString =
nullptr,
542 ThemeParseReport *report =
nullptr)
const;
566 QPalette *palette =
nullptr,
567 QHash<ThemeToken, const char *> *sources =
nullptr,
588 static QHash<ThemeToken, QColor>
flattenTokens(
const QHash<ThemeToken, ThemeColorPair> &tokens,
610 const QList<SettableKey> &
settableKeys()
const {
return settableKeys_; }
620 QColor
color(ThemeToken role)
const;
622 bool colorIsAvailable(ThemeToken role)
const;
658 QHash<ThemeToken, QColor>
previewTheme(
const QString &internalName,
661 bool *declaresWindow =
nullptr)
const;
718 static QString
styleSheet(
const QString &name);
851 static QMutex mutex_;
856 QHash<ThemeManager::ThemeToken, ThemeColorPair> themeColors_;
858 QHash<ThemeManager::ThemeToken, ThemeColorPair> parsedColors_;
859 QList<ThemeColorPair> graphColors_;
861 QHash<QString, ThemeSectionInfo> sections_;
862 QList<ThemeToken> requiredTokens_;
863 QList<SettableKey> settableKeys_;
866 QHash<QString, ThemeToken> colorRoleCache_;
867 QHash<QString, QPalette::ColorRole> paletteRoleCache_;
895 QPalette osBaseline_;
907 QPalette baselineForBuild()
const;
915 void reapplyForSchemeChange();
932 static ThemeMode modeFromPrefs(
int gui_color_scheme);
940 void applyToStyleHints();
950 void applyApplicationStyleSheet();
965 bool loadTheme(
const QString &themeName = QString());
975 QHash<ThemeManager::ThemeToken, ThemeColorPair>
colors;
1013 bool operator!=(
const ThemeDraft &other)
const {
return !(*
this == other); }
Definition system_theme_detector.h:38
static bool isDark()
Definition theme_manager.cpp:427
static void init(const QString &theme=QString())
Definition theme_manager.cpp:312
static bool systemPrefersHighContrast()
Definition theme_manager.cpp:486
static ThemeContrast effectiveContrast(int gui_contrast, ThemeContrast declared)
Definition theme_manager.cpp:495
static QString selectedThemeName()
Definition theme_manager.cpp:804
void setMode(ThemeMode mode)
Definition theme_manager.cpp:512
QColor graphColor(int idx) const
Returns the graph color for the given index, cycling through available graph colors if necessary.
Definition theme_manager.cpp:1081
static QString styleSheet(const QString &name)
Definition theme_manager.cpp:699
QHash< ThemeToken, ThemeColorPair > resolveDraftTokens(const ThemeDraft &draft, bool dark, QPalette *palette=nullptr, QHash< ThemeToken, const char * > *sources=nullptr, int gui_contrast=UseRecentContrast) const
Definition theme_manager.cpp:885
static ThemeToken tokenFromName(const QString &name)
Definition theme_manager.cpp:274
ThemeToken tokenForName(const QString &name) const
Definition theme_manager.cpp:877
static QHash< ThemeToken, QColor > flattenTokens(const QHash< ThemeToken, ThemeColorPair > &tokens, bool dark)
Definition theme_manager.cpp:938
PreviewScheme
Definition theme_manager.h:162
QString loadStyleSheet(const QString &name) const
Definition theme_manager.cpp:690
static bool isBuiltInTheme(const QString &internalName)
Definition theme_manager.cpp:786
bool loadDraft(const QString &internalName, ThemeDraft &out, QString *errorString=nullptr, ThemeParseReport *report=nullptr) const
Definition theme_manager.cpp:828
bool parseDraft(const QByteArray &jsonc, const QString &internalName, ThemeDraft &out, QString *errorString=nullptr, ThemeParseReport *report=nullptr) const
Definition theme_manager.cpp:851
ThemeMode
Definition theme_manager.h:140
static void setNoticeState(QWidget *w, const QString &state)
Definition theme_manager.cpp:725
ThemeMode mode() const
Definition theme_manager.cpp:467
static bool canDetectSystemContrast()
Definition theme_manager.cpp:477
const QList< ThemeToken > & requiredTokens() const
Definition theme_manager.h:595
QHash< ThemeToken, QColor > previewTheme(const QString &internalName, PreviewScheme scheme, int gui_contrast=UseRecentContrast, bool *declaresWindow=nullptr) const
Definition theme_manager.cpp:741
static QString personalThemesDir()
Definition theme_manager.cpp:791
static QString defaultThemeName()
Definition theme_manager.cpp:284
const QList< SettableKey > & settableKeys() const
Definition theme_manager.h:610
qsizetype graphColorCount() const
Returns the number of graph colors defined in the theme.
Definition theme_manager.cpp:1095
static void setSelectedThemeName(const QString &name)
Definition theme_manager.cpp:809
bool isDarkMode() const
Definition theme_manager.cpp:432
static QString personalThemePath(const QString &stem)
Definition theme_manager.cpp:796
static void setValidationState(QWidget *w, const QString &state)
Definition theme_manager.cpp:720
static QList< ThemeInfo > availableThemes()
Definition theme_manager.cpp:349
ThemeContrast contrast() const
Definition theme_manager.cpp:472
ThemeToken paletteRoleToken(QPalette::ColorRole role) const
Definition theme_manager.cpp:868
static QString resolveThemeName(const QString &name)
Definition theme_manager.cpp:300
bool validateThemeFile(const QString &filePath) const
Definition theme_manager.cpp:1002
static constexpr int UseRecentContrast
Definition theme_manager.h:821
ThemeManager(QObject *parent=nullptr)
Definition theme_manager.cpp:94
ThemeInfo info() const
Definition theme_manager.cpp:344
QColor color(ThemeToken role) const
Definition theme_manager.cpp:658
Definition theme_manager.h:47
void setForMode(bool isDarkMode, const QColor &color)
Definition theme_manager.h:54
QColor forMode(bool isDarkMode) const
Definition theme_manager.h:52
bool isValid() const
Definition theme_manager.h:61
static bool sameColor(const QColor &a, const QColor &b)
Definition theme_manager.h:57
Definition theme_manager.h:973
bool operator==(const ThemeDraft &other) const
Definition theme_manager.cpp:994
QHash< ThemeManager::ThemeToken, ThemeColorPair > colors
JSONC color inputs.
Definition theme_manager.h:975
bool sameColors(const ThemeDraft &other) const
Definition theme_manager.cpp:989
QList< ThemeColorPair > graphColors
Graph colors in order.
Definition theme_manager.h:976
ThemeManager::ThemeToken firstMissingRequired() const
Definition theme_manager.cpp:952
ThemeInfo info
Meta data and origin.
Definition theme_manager.h:974
int removeInvalidEntries()
Definition theme_manager.cpp:975
bool hasRequiredColors() const
Definition theme_manager.cpp:962
ThemeFontHint monospaceFont
Monospace font the theme asks for.
Definition theme_manager.h:978
ThemeFontHint regularFont
Regular font the theme asks for.
Definition theme_manager.h:977
static const QList< ThemeManager::ThemeToken > & requiredTokens()
Definition theme_manager.cpp:947
bool declaresWindow() const
Definition theme_manager.cpp:967
Definition theme_manager.h:72
QString family
Font family; empty when unset.
Definition theme_manager.h:73
int pointSize
Size in points; 0 when unset.
Definition theme_manager.h:74
bool isSet() const
Definition theme_manager.h:77
Definition theme_manager.h:31
int version
Schema version (currently 1).
Definition theme_manager.h:34
QString filePath
Resource path or file path the theme was read from.
Definition theme_manager.h:39
QString name
Display name, e.g. "Wireshark Default".
Definition theme_manager.h:32
bool builtIn
True for themes bundled as resources, false for personal files.
Definition theme_manager.h:38
ThemeContrast contrast
Declared by the theme's top-level "contrast" field.
Definition theme_manager.h:37
QString author
Theme author or organization.
Definition theme_manager.h:36
QString description
One-line description shown in preferences.
Definition theme_manager.h:35
QString internalName
Internal name, e.g. "default".
Definition theme_manager.h:33
Definition theme_manager.h:598
QString key
key name as written in the file (schema spelling)
Definition theme_manager.h:601
QString section
section name as written in the file
Definition theme_manager.h:600
Definition theme_manager.h:87
int unknownTopLevelKeys
Definition theme_manager.h:95
int invalidValues
Definition theme_manager.h:93
QStringList messages
Definition theme_manager.h:90
Definition theme_manager.h:42
ThemeContrast
Definition theme_manager.h:26