webvpf / wn-darkbackend-plugin
Dark Theme for Backend Winter CMS
Installs: 364
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 2
Forks: 4
Open Issues: 1
Language:CSS
Type:winter-plugin
Requires
- composer/installers: ~1.0
- dev-master
- v1.2.19
- v1.2.18
- v1.2.17
- v1.2.16
- v1.2.15
- v1.2.14
- v1.2.13
- v1.2.12
- v1.2.11
- v1.2.10
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.13
- v1.1.12
- v1.1.11
- v1.1.10
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.27
- v1.0.26
- v1.0.25
- v1.0.24
- v1.0.23
- v1.0.22
- v1.0.21
- v1.0.20
- v1.0.19
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
This package is auto-updated.
Last update: 2024-10-28 19:08:42 UTC
README
Plugin for Winter CMS
This plugin adds a dark theme switch to the user’s menu in backend of site. Now you can switch to dark theme for backend in one click.
Installation Сomposer:
composer require webvpf/wn-darkbackend-plugin
Styles
When dark mode is enabled, the plugin script adds dark
class for body
tag. Therefore, to override the standard styles, you need to add body.dark
before the selector name.
body.dark .className { }
CSS Variables
The plugin adds css variables to the backend:
:root { --drk-bg-color-a: #0d1117; --drk-bg-color-b: #161b22; --drk-bg-color-c: #1b222c; --drk-bg-color-fancy: #183b4e; --drk-bg-color-inset: #010409; --drk-color-a: #c9d1d9; --drk-color-b: #8b949e; --drk-color-c: #757575; --drk-color-danger: #f85149; --drk-border-color: #30363d; --drk-btn-bg-color: #21262d; --drk-hover-bg-color-a: #1f242c; --drk-hover-bg-color-b: #263850; --drk-box-shadow: 0 8px 24px #010409; }
An example of using css variables:
body.dark .myClassName { background: var(--drk-bg-color-a); }
Logo
You can upload your logo for backend customization in Customize back-end
Backend --> Settings --> Customize back-end --> Brand
If your logo is not suitable for the dark theme, then you can upload a separate dark theme logo to the media and write the following styles in Customize back-end
Backend --> Settings --> Customize back-end --> Styles
body.dark .wn-logo { background-image: url(/storage/app/media/logo-backend-dark.png); } body.dark .wn-logo-transparent { background-image: url(/storage/app/media/logo-backend-dark.png) !important; }
Events
Turning dark mode on and off triggers modeDarkEnabled
and modeDarkDisabled
events. You can set listeners for these events:
document.addEventListener('modeDarkEnabled', () => { // code when dark mode is enabled }); document.addEventListener('modeDarkDisabled', () => { // code when dark mode is disabled });
Translation for switch text
Write a comment here: #1 where specify language code and translation for text Dark Theme in your language.
How to find out language code
Open backend home page and in page code look at the value of lang
attribute for <html>
tag (e.g.: lang="en"
). This is your language code.
Protect your eyes!