Avalonia Code OnlyItaliano

API › RAVAL

RTheme class

public static class RTheme

The theme of the application: light, dark or as the system.

Properties

static RThemeMode Mode { get; set; }

The choice in use; setting it changes the theme of the application.

static bool IsDark { get; }

Whether the theme on the screen now is dark (also when chosen by the system).

Methods

static void Toggle()

Light ↔ dark, from the theme on the screen (a System choice becomes the other).

static void Remember(RSettings s, string key = "ui.theme", RThemeMode def = System)

Reads the choice from the settings (the default if missing), applies it, and writes it there at every change.

static void Fill(MenuItem menu)

Fills a menu with the three choices (texts of RLang, «raval.theme.*»), the one in use ticked.

static Button Button()

A flat button with sun or moon that toggles light and dark.

Events

event Action<RThemeMode> Changed

After the theme has changed, with the new choice.