spacr.qt.night_themes

Ten night palettes and five separate data-art presets.

A night theme is one choice that moves three things at once: the colours the interface is painted in (spacr.qt.theme.THEMES grows by ten because of this module), which ambient animation runs behind it and in which colours (spacr.qt.widgets.ambient), and which set of sounds spaCR plays if the user has ever switched sound on (spacr.qt.sound_synth). Choosing one in Preferences therefore changes how spaCR looks and how it sounds, which is the whole point of the family.

This module is Qt-free on purpose, the same way spacr.qt.sound_synth is: spacr.qt.preferences imports it to validate a stored theme name and must not pull QtGui or QtWidgets in while doing so. It holds data and three lookups and imports nothing from the rest of spaCR, so spacr.qt.theme, spacr.qt.widgets.ambient and spacr.qt.sound_synth can all read from it without a cycle.

THE PALETTES ARE LITERALS RATHER THAN A RECIPE. Each one was generated from a hue and a saturation over a shared lightness ramp, then checked against spacr.qt.theme.contrast_failures() and spacr.qt.theme.page_separation_failures() and written down. Keeping the numbers here rather than the recipe means the published colours are the reviewed colours, no solver runs at import, and tests/qt/test_ten_night_themes.py judges what actually ships.

THREE COLOURS WERE MOVED OFF THE RECIPE BY MEASUREMENT, and they are the only three. Nocturne’s and Aphelion’s accent_lo failed bg against accent_lo at 4.5:1 undressed — a deep blue and a deep violet are simply too dark at the recipe’s lightness — and Vesper’s failed it at 4.49:1 at one of the sixty hue offsets the spaceout dressing can reach. All three were raised until they passed, and nothing else was touched. See docs/notes/spacr/qt/night_themes.md.

THREE ROLES ARE THE SAME IN ALL TEN, and deliberately: success, warning and error. A red that means this run failed must not become a theme decision, so the status hues do not follow the palette around the colour wheel. fg is white in all ten for the same reason a night palette wants it: every surface here is dark.

NIGHT_THEMES is ordered by hue, warm through cool and back round to rose, so the Theme menu reads as one family rather than ten unrelated entries.

The data-art catalog appends five independent palette presets. Its keys select distinct ambient producers and existing sound sets without changing the ten original night identities. Its explicit colour overrides retain the night palettes’ stable status hues and are checked by the same contrast and page-separation rules.

Classes

NightTheme

One palette preset: its label, colours, backdrop and sound set.

Functions

ambient_for(→ Tuple[str, str])

The backdrop name asks for.

is_night_theme(→ bool)

True when name is one of the ten.

palettes(→ Dict[str, Dict[str, str]])

Every night palette, by theme key.

sound_for(→ str)

The sound set name asks for.

theme_for(→ NightTheme)

The night or data-art palette preset called name.

Module Contents

class spacr.qt.night_themes.NightTheme[source]

One palette preset: its label, colours, backdrop and sound set.

Parameters:
  • key – stable identifier in the theme preference and palette map.

  • label – name shown in Preferences.

  • description – one sentence shown as the choice’s explanation.

  • palette – the full interface palette, every role spacr.qt.theme.palette_for() promises.

  • ambient – the ambient animation this theme runs behind it, one of spacr.qt.widgets.ambient.AMBIENT_THEMES.

  • ambient_palette – the colour set that animation is painted in, a key of spacr.qt.widgets.ambient.PALETTE_SETS.

  • sound_key – existing sound-set key for data-art presets; None retains the original night theme’s matching sound key.

property sound: str[source]

Key of an existing sound set; night presets keep their own.

spacr.qt.night_themes.ambient_for(name: str) → Tuple[str, str][source]

The backdrop name asks for.

Parameters:

name – one of NIGHT_THEME_KEYS or DATA_ART_THEME_KEYS.

Returns:

(animation, palette) — an spacr.qt.widgets.ambient.AMBIENT_THEMES name and a spacr.qt.widgets.ambient.PALETTE_SETS key.

Raises:

KeyError – if name is unknown.

spacr.qt.night_themes.is_night_theme(name) → bool[source]

True when name is one of the ten.

Parameters:

name – a theme key, or anything at all.

Returns:

whether NIGHT_THEMES has it.

spacr.qt.night_themes.palettes() → Dict[str, Dict[str, str]][source]

Every night palette, by theme key.

Returns:

a fresh mapping of key to a copy of that theme’s palette, shaped for spacr.qt.theme._PALETTES.

spacr.qt.night_themes.sound_for(name: str) → str[source]

The sound set name asks for.

Parameters:

name – one of NIGHT_THEME_KEYS or DATA_ART_THEME_KEYS.

Returns:

a key of spacr.qt.sound_synth.SOUND_THEMES.

Raises:

KeyError – if name is unknown.

spacr.qt.night_themes.theme_for(name: str) → NightTheme[source]

The night or data-art palette preset called name.

Parameters:

name – one of NIGHT_THEME_KEYS or DATA_ART_THEME_KEYS.

Returns:

the theme.

Raises:

KeyError – if name is unknown.