commit 55e03bb1dbcff6fa0af43a473b55b0d1b0e848b6 Author: Florent Date: Fri Jun 5 11:16:42 2026 +0000 Initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..561ee60 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# 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 ``) +- 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