huseyinfiliz / simple-dark-mode
A simple dark mode toggle for Flarum 2
Package info
github.com/huseyinfiliz/simple-dark-mode
Language:TypeScript
Type:flarum-extension
pkg:composer/huseyinfiliz/simple-dark-mode
Requires
- flarum/core: ^2.0
Requires (Dev)
- flarum/testing: ^2.0
README
Simple Dark Mode
A simple dark mode toggle extension for Flarum 2.
Simple Dark Mode adds a quick theme toggle to your forum header, allowing users and guests to switch between light and dark mode without opening the full appearance settings.
Features
- 🌙 Quick theme toggle: Adds a simple light/dark mode button to the forum header.
- 👤 User preference support: Logged-in users keep their selected theme through Flarum preferences.
- 👥 Guest support: Guest users can also switch themes, with their choice stored locally in the browser.
- ♿ High contrast support: Preserves Flarum's high contrast modes when switching between light and dark.
- ⚙️ Admin settings: Control header visibility and icon style.
Installation
composer require huseyinfiliz/simple-dark-mode:"*"
php flarum cache:clear
Then enable the extension from your admin panel.
Updating
composer update huseyinfiliz/simple-dark-mode:"*"
php flarum cache:clear
Removing
composer remove huseyinfiliz/simple-dark-mode php flarum cache:clear
Notes
This extension is intentionally simple. It does not add a custom theme system; it uses Flarum's existing color scheme support and provides a faster way to switch between modes.
High contrast modes are preserved when toggling:
light -> dark
dark -> light
light-hc -> dark-hc
dark-hc -> light-hc
For guest users, the selected theme is stored in the browser. This means the preference may be cleared if the browser storage is cleared or when using private/incognito mode.
Links
If you liked this extension, don't forget to check out my other extensions too: huseyinfiliz.com/flarum
License
Released under the MIT License.