Generalized to dynamic-theme-style

This commit is contained in:
2025-12-14 19:46:13 +01:00
parent 83f1d8f315
commit 10b7d2b261
7 changed files with 114 additions and 74 deletions

View File

@@ -1,6 +1,6 @@
# LL Theme Style Darkmode
# LL Dynamic Theme Style
Automatically switches between light and dark theme stil variantes based on system/browser color scheme preference.
Dynamic selection of theme style variants. Supports URL-based selection and automatic switching based on system/browser preference. Cookie-based selections persist and are only changed via the URL parameter (except default <-> 01-evening preference switch).
## Features
@@ -9,7 +9,7 @@ Automatically switches between light and dark theme stil variantes based on syst
## Requirements
- Theme stil variant files: `styles/default.json` and `styles/01-evening.json`
- Theme variant files: `styles/default.json` and `styles/01-evening.json`
## Configuration
@@ -38,12 +38,13 @@ Example structure:
}
```
### URL Parameter
Change the active variant by adding `?style=your-variant` to the URL. This will store the selection in a cookie and is the only way to change the stored variant programmatically. Example: `?style=01-evening` or `?style=default`.
### Customize Variants
Edit [auto-style-switch.js](assets/js/auto-style-switch.js) line 8:
```javascript
const desired = prefersDark ? '01-evening' : 'default';
```
Edit [auto-style-switch.js](assets/js/auto-style-switch.js) to change the default variant names if needed.
## Architecture
@@ -52,7 +53,7 @@ const desired = prefersDark ? '01-evening' : 'default';
- **Functions.php** Namespaced helper functions
- **auto-style-switch.js** Frontend detection
All code uses `LasLie\ThemeStyleDarkmode` namespace.
All code uses `LasLie\DynamicThemeStyle` namespace.
## License