Skip to content

theme.cpp

file src/app/theme/theme.cpp ยท Applications

The colour tables of the night-bridge and daylight looks, the style-sheet template and the Theme singleton that applies them.

Source src/app/theme/theme.cpp

Namespaces

Namespace Description
nmeasim::app::theme The look of the desktop application: the Theme singleton with its night-bridge and daylight looks and the option to follow the desktop, and the code-painted icons.

Namespace members

Declared or defined in this file and documented on the page of their namespace.

Member Description
nmeasim::app::theme::to_string Returns the name under which a mode is stored in the preferences.
nmeasim::app::theme::mode_from_string Parses a mode name stored in the preferences.
nmeasim::app::theme::colors_for Returns the colour table of a look.
nmeasim::app::theme::style_sheet Generates the application style sheet of a look from its colours.

Summary

File-local functions

Name Description
night_colors() Builds the colour table of the night-bridge look: charcoal and navy panels, cyan accent, map tiles dimmed by 45 %.
day_colors() Builds the colour table of the daylight look: white and light grey panels, teal accent, map tiles undimmed.
css() Writes a colour in Qt style-sheet syntax.
with_alpha() Returns a colour with another opacity.

File-local variables

Name Description
kStyleTemplate Style sheet shared by both looks, with {token} placeholders that style_sheet replaces by the colours of the look.

File-local functions

night_colors()

Colors night_colors()

Builds the colour table of the night-bridge look: charcoal and navy panels, cyan accent, map tiles dimmed by 45 %.

Returns Colors: The night colours; colors_for keeps one copy for the whole program.

Declared in src/app/theme/theme.cpp:26

day_colors()

Colors day_colors()

Builds the colour table of the daylight look: white and light grey panels, teal accent, map tiles undimmed.

Returns Colors: The day colours; colors_for keeps one copy for the whole program.

Declared in src/app/theme/theme.cpp:63

css()

QString css(const QColor& color)

Writes a colour in Qt style-sheet syntax.

Parameters

Name Type Description
color const QColor& Colour to write.

Returns QString: #rrggbb for an opaque colour, otherwise rgba(r, g, b, a) with every component from 0 to 255, as Qt style sheets read it.

Declared in src/app/theme/theme.cpp:101

with_alpha()

QColor with_alpha(QColor color, int alpha)

Returns a colour with another opacity.

Parameters

Name Type Description
color QColor Colour to change; taken by value.
alpha int Opacity from 0 (transparent) to 255 (opaque).

Returns QColor: color with its alpha replaced by alpha.

Declared in src/app/theme/theme.cpp:115

File-local variables

kStyleTemplate

const char* kStyleTemplate

Style sheet shared by both looks, with {token} placeholders that style_sheet replaces by the colours of the look.

Input fields (line edits, spin boxes, combo boxes) are left to the Fusion style and the palette: styling them here would also restyle the editor inside every spin box and drop its arrows. Object names such as instrument_tile, tile_value, map_button and dashboard_content select widgets that set those names; the dynamic property overridden marks an instrument tile whose value is overridden.

Declared in src/app/theme/theme.cpp:128