mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-13 20:53:07 +00:00
d684a5bc1e
Add `traits` module instead
27 lines
693 B
Rust
27 lines
693 B
Rust
extern crate cursive;
|
|
|
|
use cursive::Cursive;
|
|
use cursive::views::Dialog;
|
|
use cursive::theme::BorderStyle;
|
|
|
|
fn main() {
|
|
let mut siv = Cursive::new();
|
|
|
|
siv.add_layer(Dialog::text("This is a dynamic theme example!")
|
|
.button("Change", |s| {
|
|
let mut theme = s.current_theme().clone();
|
|
|
|
theme.shadow = !theme.shadow;
|
|
theme.borders = match theme.borders {
|
|
Some(BorderStyle::Simple) => Some(BorderStyle::Outset),
|
|
Some(BorderStyle::Outset) => None,
|
|
None => Some(BorderStyle::Simple),
|
|
};
|
|
|
|
s.set_theme(theme);
|
|
})
|
|
.button("Quit", Cursive::quit));
|
|
|
|
siv.run();
|
|
}
|