Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Latest commit

 

History

History
43 lines (36 loc) · 2 KB

File metadata and controls

43 lines (36 loc) · 2 KB

Simple Custom Theme CSS that loads Dark/Blue Theme based on "prefers-color-scheme" Media Query.

Installation Instructions

  1. Copy APP.php to /usr/share/zabbix/include/classes/core/APP.php
    This File adds a "Auto Theme" to the Default Theme pool by overriding the Method getThemes() from ZBase.
    If you already have a File like this simply add this Code your class APP extends ZBase
    public static function getThemes() {
        return array_merge(parent::getThemes(), [
            /* 'css_file_name_without_extension' => _('theme_name_in_ui') */
                'automatic_dark_mode' => _('Auto Theme')
        ]);
    }
  2. Copy automatic_dark_mode.css to /usr/share/zabbix/assets/style/auto_dark_mode.css
    This CSS File simply imports either blue-theme.css or dark-theme.css depending on what the media query prefers-color-scheme returns. (dark/light) You can also import alternate *.css Files by simply changing url('<file>').

After you restart the Zabbix Frontend, a new Theme called Auto Theme should appear.

Installation Instructions with Docker Compose

  1. Create a Data or Provisioning Folder withing you Compose Project
    The "Source" Files will be placed in this Directory
    Only APP.php and automatic_dark_mode.css is required
  2. Added Read-Only Mounts to your Docker Compose File
    volumes:
        - ./provisioning/zabbix/frontend/APP.php:/usr/share/zabbix/include/classes/core/APP.php:ro
        - ./provisioning/zabbix/frontend/automatic_dark_mode.css:/usr/share/zabbix/assets/styles/automatic_dark_mode.css:ro
    This will add both Files as Read-Only Mounts

This should be enough, but depending on your Docker Compose Project you might need to
complete additonal steps

Open Tasks:

  • Make this Work with Color Schemes from Graphs/Plots. Those are not controlled by CSS but by a PHP Code in charts<0-7>.php