/plugins/dark_mode

The module defines a darkTheme object to be applied with the cssColour.setTheme utility.

Requires

  • module:/ui/utils/cssColour

Methods

(inner) custom_theme(theme)

The custom_theme object from the locale will be applied through the cssColourTheme utility.

Parameters:
NameTypeDescription
themeObject

The colourTheme to be applied.

Example
"custom_theme": {
      "primary": "#311250",
      "base": "#f2f2f2",
      "base-secondary": "#f7f7f7",
      "base-tertiary": "#fafafa",
      "font": "#3f3f3f",
      "font-mid": "#858585",
      "font-contrast": "#dddddd",
      "border": "#dddddd",
      "active": "#c864dc",
      "hover": "#939faa",
      "changed": "#ffffa7",
      "info": "#00695c",
      "danger": "#A21309"
    }

(inner) dark_mode()

The dark_mode plugin method adds a button to the mapview controls which allows to toggle the application of a darkTheme defined in this module.

Whether the darkTheme should be applied by default is stored as darkMode flag in the localStorage.

(inner) updateUser()

This function updates the user object in the IndexedDB. Removes roles, admin and, blocked flag from the user to prevent these properties being overwritten.