37 lines
1.4 KiB
Markdown
37 lines
1.4 KiB
Markdown
# TT5 Light/Dark Toggle
|
||
|
||
WordPress plugin that adds a **light/dark mode toggle** for the [Twenty Twenty-Five](https://wordpress.org/themes/twentytwentyfive/) theme.
|
||
|
||
## Features
|
||
|
||
- Floating toggle button (bottom-right)
|
||
- Remembers choice in `localStorage` and a cookie
|
||
- Logged-in users: preference saved to user meta
|
||
- Respects system `prefers-color-scheme` on first visit (until the user chooses)
|
||
- No flash of wrong theme (inline script in `<head>`)
|
||
- Dark palette tuned for TT5 default color presets
|
||
|
||
## Requirements
|
||
|
||
- WordPress 6.4+
|
||
- Active theme: **Twenty Twenty-Five** (or a child theme of it)
|
||
|
||
## Installation
|
||
|
||
1. Copy the `tt5-light-dark-toggle` folder to `wp-content/plugins/`.
|
||
2. Activate **TT5 Light/Dark Toggle** under **Plugins**.
|
||
3. Visit your site — a **Dark** / **Light** button appears at the bottom-right.
|
||
|
||
## How it works
|
||
|
||
Twenty Twenty-Five does not ship with a built-in light/dark switch. This plugin overrides the theme’s CSS preset variables (`--wp--preset--color--*`) when `html` has the class `tt5-ldt-dark`, giving a readable dark version of the default style without changing your theme files.
|
||
|
||
## Notes
|
||
|
||
- Works with the **default** TT5 palette. If you use a **style variation** (Evening, Midnight, etc.), colors may look different; the toggle still swaps to a dark-friendly palette.
|
||
- Custom blocks with hard-coded hex colors in the editor are not auto-adjusted.
|
||
|
||
## License
|
||
|
||
GPL-2.0-or-later
|