Files
Light-Dark_Mode_Toggle/README.md
T
2026-06-05 11:16:42 +00:00

37 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 themes 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