# native-theme-gpui
[gpui](https://gpui.rs/) + [gpui-component](https://crates.io/crates/gpui-component)
toolkit connector for [native-theme](https://crates.io/crates/native-theme).
Maps `native_theme::NativeTheme` data to gpui-component's theming system,
producing a fully configured `Theme` with correct colors, fonts, geometry,
and icons for all gpui-component widgets.
## Usage
Add both crates to your `Cargo.toml`:
```toml
[dependencies]
native-theme = "0.3"
native-theme-gpui = "0.3"
```
Then create a gpui-component theme from any native-theme preset or OS theme:
```rust
use native_theme::NativeTheme;
use native_theme_gpui::{pick_variant, 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) = pick_variant(&nt, is_dark) {
let theme = to_theme(variant, "My App", is_dark);
// Use `theme` in your gpui-component application
}
```
Or read the OS theme at runtime:
```rust
use native_theme::{from_system, NativeTheme};
use native_theme_gpui::{pick_variant, to_theme};
charts, overlays, etc.) themed with native-theme presets, with live theme
switching and a color map inspector.
## 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.