visualdynamics.theme¶
theme
¶
Light/dark theme colors shared by the 3D view, 2D plots, and the GUI — and the one answer to "which is it right now".
The colors are for the things visualdynamics draws itself (the VTK
scene and the pyqtgraph plots); Qt's own widgets take theirs from the
application palette. Which scheme applies is decided here too, in
system_scheme: a statement for this launch (VISUALDYNAMICS_THEME,
which the --theme flag sets), else what Qt reports, else — on Linux,
where a packaged build without a platform-theme plugin made Qt answer
Unknown on a dark desktop (2026-09-14) — the desktop asked directly
through desktop_scheme (the settings portal, then GNOME's key, then
KDE's file), else the palette's own lightness. The user's remembered
choice, and telling Qt to wear a scheme rather than follow the OS,
live in gui/preferences.py, which is Qt's side of this.
Functions:
| Name | Description |
|---|---|
theme |
Resolve a theme name (or a colors dict) to a colors dict. |
colormap |
|
system_scheme |
'dark' or 'light': the environment's say, else the OS appearance |
desktop_scheme |
The Linux desktop's own answer, or None where there is none. |
Functions:¶
theme
¶
Resolve a theme name (or a colors dict) to a colors dict.
Source code in src/visualdynamics/theme.py
colormap
¶
values in 0..1 as an (N, 3) array of RGB, on VIRIDIS.
Source code in src/visualdynamics/theme.py
system_scheme
¶
'dark' or 'light': the environment's say, else the OS appearance via Qt, else the desktop asked directly, else the palette.
Falls back to the default theme when Qt or an application instance is unavailable (e.g. plain scripting use).
Source code in src/visualdynamics/theme.py
desktop_scheme
¶
The Linux desktop's own answer, or None where there is none.
Three doors, in the order a modern desktop answers them: the XDG
settings portal's color-scheme (GNOME, KDE and the rest, over
D-Bus through gdbus, which ships with GLib), GNOME's
gsettings key of the same name, and KDE's kdeglobals. Each is
a subprocess or a file read with a short timeout, and any failure
is "no answer" — never an exception in the way of a window.
platform, run and home are for the tests.