The theme tiles of the picker strip. More...
#include <PhosphorShellPicker/ThemePresets.h>
Signals | |
| void | directoryChanged () |
| void | presetsChanged () |
Public Member Functions | |
| ThemePresets (QObject *parent=nullptr) | |
| Where user palettes live. Defaults to defaultDirectory(). | |
| ~ThemePresets () override | |
| QString | directory () const |
| void | setDirectory (const QString &directory) |
| QVariantList | presets () const |
| int | count () const |
| bool | isCompletePalette (const QVariantMap &tokens) const |
| Whether a palette supplies every standard color used by Appearance. | |
| void | rescan () |
| Rebuild the list: the two built-ins, then the directory's files by name. | |
| QVariantMap | tokensFor (const QString &name) const |
| The tokens of the preset called name, or an empty map. | |
Static Public Member Functions | |
| static QString | defaultDirectory () |
| <AppLocalDataLocation>/palettes, beside the committed palette. | |
| static QVariantMap | darkPalette () |
| The canonical dark palette. | |
| static QVariantMap | lightPalette () |
| The light variant: sky, blue, violet, rose on #F6F9FF. | |
| static QVariantList | swatchesFor (const QVariantMap &tokens) |
| The five swatches a tile shows for tokens. | |
| static QVariantMap | readPaletteFile (const QString &path) |
| Parse one palette file into a token map (empty on failure). | |
The theme tiles of the picker strip.
Two are built in: Dark (PaletteStore's canonical palette) and Light (the same spectrum on a pale ground, per the light variant in the picker mock). Any palette JSON in directory follows, one tile per file, named by its base name; current.json is skipped because it is the shell's own committed palette, not a preset. Files use the { "tokens": { ... } } shape PaletteStore reads, a flat object is accepted too.
Each preset is { name, tokens, swatches }: swatches is the five-colour strip a tile draws (surface, container, primary, secondary, tertiary), tokens is what the retint applies.
|
explicit |
Where user palettes live. Defaults to defaultDirectory().
|
override |
|
nodiscard |
|
staticnodiscard |
The canonical dark palette.
|
staticnodiscard |
<AppLocalDataLocation>/palettes, beside the committed palette.
|
nodiscard |
|
signal |
|
nodiscard |
Whether a palette supplies every standard color used by Appearance.
|
staticnodiscard |
The light variant: sky, blue, violet, rose on #F6F9FF.
|
nodiscard |
|
signal |
|
staticnodiscard |
Parse one palette file into a token map (empty on failure).
| void PhosphorShellPicker::ThemePresets::rescan | ( | ) |
Rebuild the list: the two built-ins, then the directory's files by name.
Emits presetsChanged only when something differs.
| void PhosphorShellPicker::ThemePresets::setDirectory | ( | const QString & | directory | ) |
|
staticnodiscard |
The five swatches a tile shows for tokens.
|
nodiscard |
The tokens of the preset called name, or an empty map.