https://github.com/friendlymatthew/leptos-theme
a theme abstraction for leptos applications
https://github.com/friendlymatthew/leptos-theme
harvey-dent leptos themes wasm
Last synced: 11 months ago
JSON representation
a theme abstraction for leptos applications
- Host: GitHub
- URL: https://github.com/friendlymatthew/leptos-theme
- Owner: friendlymatthew
- Created: 2024-01-05T02:23:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-08T17:16:30.000Z (over 2 years ago)
- Last Synced: 2025-07-16T19:09:59.426Z (11 months ago)
- Topics: harvey-dent, leptos, themes, wasm
- Language: Rust
- Homepage: https://leptos-theme.vercel.app
- Size: 8.69 MB
- Stars: 10
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 🌗 *leptos-theme*
`leptos-theme` effortlessly toggles between light and dark modes in your leptos application.
[](https://crates.io/crates/leptos_theme)

[](https://discord.gg/XhVbKk38ux)

## Quick Start
You can set up dark mode with two lines:
Wrap your project with ``:
```html
view! {
}
```
Now your `HomePage` and `ErrorPage` are dark mode ready!
Toggle themes on-the-fly with `use_theme()`:
```rust
use leptos_theme::{
theme::use_theme,
types::Theme
};
// inside
let current_theme = use_theme();
view! {
Light Mode
}
```
That's it!
## Features
- Choose between class or data attribute selectors
- Harmonize with system preferences using `prefers-color-scheme`
- Keep themes consistent across multiple tabs and windows
## Demo
`leptos_theme` supports both class and data attribute selectors.
- For a tailwind + class selector demo: https://leptos-theme.vercel.app/
- [How to guide](https://github.com/friendlymatthew/leptos-theme/tree/main/example/demo#readme)
- For a pure CSS + data selector demo: https://leptos-theme-data-attribute.vercel.app/
- [How to guide](https://github.com/friendlymatthew/leptos-theme/tree/main/example/demo-pure-css#readme)
## Contributions
Check the [issues](https://github.com/friendlymatthew/leptos-theme/issues) page and feel free to post a PR!
## Bugs, Issues, Feature Requests
[Robert](https://github.com/JustBobinAround) and I created `leptos_theme` with the intention of usability. If you encounter any bugs, issues, or feature requests, [please feel free to open an issue.](https://github.com/friendlymatthew/leptos-theme/issues/new)
## CHANGELOG
### Update - `v.1.2` February 8th, 2024
- elevated `leptos` to 0.6.5