# native-theme-iced
[iced](https://iced.rs/) toolkit connector for
[native-theme](https://crates.io/crates/native-theme).
Maps `native_theme::NativeTheme` data to iced's theming system, producing a
fully configured `iced::Theme` with correct colors for all built-in widget
styles via iced's Catalog system.
## Usage
Add both crates to your `Cargo.toml`:
```toml
[dependencies]
native-theme = "0.4"
native-theme-iced = "0.4"
```
Then create an iced theme from any native-theme preset or OS theme:
```rust
use native_theme::NativeTheme;
use native_theme_iced::to_theme;
// Load a preset
let nt = NativeTheme::preset("dracula").unwrap();
// Pick light or dark variant (with cross-fallback)
let is_dark = true;
if let Some(variant) = nt.pick_variant(is_dark) {
let theme = to_theme(variant, "My App");
// Use `theme` as your iced application theme
}
```
Or read the OS theme at runtime:
```rust
use native_theme::{from_system, NativeTheme};
use native_theme_iced::to_theme;
call it on every frame tick. Use `Rotation::Floating` (not `Rotation::Solid`)
for spin animations to avoid layout jitter during rotation.
## Example
Run the showcase widget gallery to explore all 17 presets interactively:
```sh
cargo run -p native-theme-iced --example showcase
```
<table>
<tr><th></th><th>Material Light</th><th>Material Dark</th><th>Lucide Light</th><th>Lucide Dark</th></tr>
<tr>
<td><strong>Linux</strong></td>
<td><img src="../../docs/assets/iced-linux-material-light.png" width="200" alt="Linux Material Light"></td>
<td><img src="../../docs/assets/iced-linux-material-dark.png" width="200" alt="Linux Material Dark"></td>
<td><img src="../../docs/assets/iced-linux-lucide-light.png" width="200" alt="Linux Lucide Light"></td>
<td><img src="../../docs/assets/iced-linux-lucide-dark.png" width="200" alt="Linux Lucide Dark"></td>
</tr>
<tr>
<td><strong>macOS</strong></td>
<td><img src="../../docs/assets/iced-macos-material-light.png" width="200" alt="macOS Material Light"></td>
<td><img src="../../docs/assets/iced-macos-material-dark.png" width="200" alt="macOS Material Dark"></td>
<td><img src="../../docs/assets/iced-macos-lucide-light.png" width="200" alt="macOS Lucide Light"></td>
<td><img src="../../docs/assets/iced-macos-lucide-dark.png" width="200" alt="macOS Lucide Dark"></td>
</tr>
<tr>
<td><strong>Windows</strong></td>
<td><img src="../../docs/assets/iced-windows-material-light.png" width="200" alt="Windows Material Light"></td>
<td><img src="../../docs/assets/iced-windows-material-dark.png" width="200" alt="Windows Material Dark"></td>
<td><img src="../../docs/assets/iced-windows-lucide-light.png" width="200" alt="Windows Lucide Light"></td>
<td><img src="../../docs/assets/iced-windows-lucide-dark.png" width="200" alt="Windows Lucide Dark"></td>
</tr>
</table>
The showcase displays all iced widgets (buttons, inputs, sliders, checkboxes,
togglers, etc.) themed with native-theme presets, with live theme switching
and a color map inspector.
Generate screenshots automatically:
```sh
cargo run -p native-theme-iced --example showcase --release -- \
--icon-set material --variant dark --tab icons \
--screenshot docs/assets/iced-linux-material-dark.png
```
## License
Licensed under either of
- [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
- [MIT License](http://opensource.org/licenses/MIT)
- [0BSD License](https://opensource.org/license/0bsd)
at your option.