2016-08-05 00:27:04 +00:00
|
|
|
extern crate cursive;
|
|
|
|
|
2016-09-29 05:45:27 +00:00
|
|
|
use cursive::Cursive;
|
|
|
|
use cursive::views::Dialog;
|
2016-08-05 00:27:04 +00:00
|
|
|
use cursive::theme::BorderStyle;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut siv = Cursive::new();
|
|
|
|
|
|
|
|
siv.add_layer(Dialog::text("This is a dynamic theme example!")
|
2016-09-29 05:45:27 +00:00
|
|
|
.button("Change", |s| {
|
|
|
|
let mut theme = s.current_theme().clone();
|
2016-08-05 00:27:04 +00:00
|
|
|
|
2016-09-29 05:45:27 +00:00
|
|
|
theme.shadow = !theme.shadow;
|
|
|
|
theme.borders = match theme.borders {
|
|
|
|
Some(BorderStyle::Simple) => Some(BorderStyle::Outset),
|
|
|
|
Some(BorderStyle::Outset) => None,
|
|
|
|
None => Some(BorderStyle::Simple),
|
|
|
|
};
|
2016-08-05 00:27:04 +00:00
|
|
|
|
2016-09-29 05:45:27 +00:00
|
|
|
s.set_theme(theme);
|
|
|
|
})
|
|
|
|
.button("Quit", Cursive::quit));
|
2016-08-05 00:27:04 +00:00
|
|
|
|
|
|
|
siv.run();
|
|
|
|
}
|