Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorShellPicker::ThemePresets Class Reference

The theme tiles of the picker strip. More...

#include <PhosphorShellPicker/ThemePresets.h>

Inheritance diagram for PhosphorShellPicker::ThemePresets:
[legend]

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).

Detailed Description

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.

Constructor & Destructor Documentation

◆ ThemePresets()

PhosphorShellPicker::ThemePresets::ThemePresets ( QObject * parent = nullptr)
explicit

Where user palettes live. Defaults to defaultDirectory().

◆ ~ThemePresets()

PhosphorShellPicker::ThemePresets::~ThemePresets ( )
override

Member Function Documentation

◆ count()

int PhosphorShellPicker::ThemePresets::count ( ) const
nodiscard

◆ darkPalette()

QVariantMap PhosphorShellPicker::ThemePresets::darkPalette ( )
staticnodiscard

The canonical dark palette.

◆ defaultDirectory()

QString PhosphorShellPicker::ThemePresets::defaultDirectory ( )
staticnodiscard

<AppLocalDataLocation>/palettes, beside the committed palette.

◆ directory()

QString PhosphorShellPicker::ThemePresets::directory ( ) const
nodiscard

◆ directoryChanged

void PhosphorShellPicker::ThemePresets::directoryChanged ( )
signal

◆ isCompletePalette()

bool PhosphorShellPicker::ThemePresets::isCompletePalette ( const QVariantMap & tokens) const
nodiscard

Whether a palette supplies every standard color used by Appearance.

◆ lightPalette()

QVariantMap PhosphorShellPicker::ThemePresets::lightPalette ( )
staticnodiscard

The light variant: sky, blue, violet, rose on #F6F9FF.

◆ presets()

QVariantList PhosphorShellPicker::ThemePresets::presets ( ) const
nodiscard

◆ presetsChanged

void PhosphorShellPicker::ThemePresets::presetsChanged ( )
signal

◆ readPaletteFile()

QVariantMap PhosphorShellPicker::ThemePresets::readPaletteFile ( const QString & path)
staticnodiscard

Parse one palette file into a token map (empty on failure).

◆ rescan()

void PhosphorShellPicker::ThemePresets::rescan ( )

Rebuild the list: the two built-ins, then the directory's files by name.

Emits presetsChanged only when something differs.

◆ setDirectory()

void PhosphorShellPicker::ThemePresets::setDirectory ( const QString & directory)

◆ swatchesFor()

QVariantList PhosphorShellPicker::ThemePresets::swatchesFor ( const QVariantMap & tokens)
staticnodiscard

The five swatches a tile shows for tokens.

◆ tokensFor()

QVariantMap PhosphorShellPicker::ThemePresets::tokensFor ( const QString & name) const
nodiscard

The tokens of the preset called name, or an empty map.


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