| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
ThemeTokenHandler Class Reference

`#include <theme_token_handler.h>`

## Public Types
using | TokenMap = QHash<ThemeManager::ThemeToken, ThemeColorPair>

## Static Public Member Functions
static void | deriveAll (TokenMap &tokens, bool isDarkMode, const QPalette &palette)

## Detailed Description

Computes every derived token from the mandatory brand+accent colors (plus the current QPalette for section-header-style derivations).

The handler reads the already-populated token map (brand / accent / expert / packets / conversation / palette from the theme), and enriches it in place with the generated tokens:

Header* (from brand) SectionHeader / SectionHeaderHover (from brand + QPalette::Mid) TextOnDark / TextOnDarkMuted (from brand.deep) Update* (from accent.success) Packets* (from brand + palette base/text) Conversation* (from brand + accent + base) Expert* (from accent variants — alpha-blend) AccentOrange / AccentGreen (aliases from accent.success)

Only-if-missing semantics: if a theme has already supplied a specific token explicitly (e.g. a theme that overrides HeaderGradientStart), the derivation leaves that value alone. Matches the behavior ThemeManager::derive() had with overwrite=false.

## Member Function Documentation

## ◆ deriveAll()

void ThemeTokenHandler::deriveAll | ( | TokenMap & | tokens,
|  | bool | isDarkMode,
|  | const QPalette & | palette )
| static

Enriches tokens in-place with every derived role.

Parameters

  tokens | Map populated from theme.jsonc parsing. Must contain the mandatory brand + accent colors; the derivation will read them and write back the generated entries.
  isDarkMode | Selects which side of palette-override color pairs to consult for Packets/Conversation derivations. Does not affect tokens that store both light/dark variants — those are derived from the pair wholesale.
  palette | The palette to read Mid and other base roles from. Pass the palette returned by ThemePaletteBuilder::build() so derivation uses the new values even before the palette has been pushed to QApplication (fixes Qt 5 signal-ordering: ApplicationPaletteChanged fires synchronously inside setPalette(), so tokens must be ready before that call). Defaults to QApplication::palette() for backwards-compatible call sites.

The documentation for this class was generated from the following files:

- /builds/wireshark/wireshark/ui/qt/utils/themes/theme_token_handler.h
- /builds/wireshark/wireshark/ui/qt/utils/themes/theme_token_handler.cpp