Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::AppearanceTracker Class Reference

Tracks OS-level appearance (light/dark mode) and auto-switches themes. More...

#include <appearance_tracker.hpp>

Public Member Functions

 AppearanceTracker ()
 ~AppearanceTracker ()
Appearance current_appearance () const
 Get current system appearance.
bool poll ()
 Poll for appearance changes.
void on_appearance_changed (std::function< void(Appearance)> callback)
 Register a callback for appearance changes.
void lock (Appearance appearance)
 Lock to a specific appearance, ignoring OS changes.
void unlock ()
 Unlock and resume tracking OS appearance.
bool is_locked () const
 Check if appearance is locked.
Appearance locked_appearance () const
 Get the locked appearance (only valid when is_locked() is true).

Detailed Description

Tracks OS-level appearance (light/dark mode) and auto-switches themes.

On macOS, observes NSAppearance changes via NSApp effective appearance. On Windows, monitors the AppsUseLightTheme registry key. On Linux/other platforms, defaults to dark and does not auto-detect.

Constructor & Destructor Documentation

◆ AppearanceTracker()

pulp::view::AppearanceTracker::AppearanceTracker ( )

◆ ~AppearanceTracker()

pulp::view::AppearanceTracker::~AppearanceTracker ( )

Member Function Documentation

◆ current_appearance()

Appearance pulp::view::AppearanceTracker::current_appearance ( ) const

Get current system appearance.

◆ is_locked()

bool pulp::view::AppearanceTracker::is_locked ( ) const
inline

Check if appearance is locked.

◆ lock()

void pulp::view::AppearanceTracker::lock ( Appearance appearance)

Lock to a specific appearance, ignoring OS changes.

◆ locked_appearance()

Appearance pulp::view::AppearanceTracker::locked_appearance ( ) const
inline

Get the locked appearance (only valid when is_locked() is true).

◆ on_appearance_changed()

void pulp::view::AppearanceTracker::on_appearance_changed ( std::function< void(Appearance)> callback)

Register a callback for appearance changes.

The callback receives the new appearance.

◆ poll()

bool pulp::view::AppearanceTracker::poll ( )

Poll for appearance changes.

Call this periodically (e.g., once per frame). Returns true if the appearance changed since last poll.

◆ unlock()

void pulp::view::AppearanceTracker::unlock ( )

Unlock and resume tracking OS appearance.


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