mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-10 03:10:41 +00:00
5ac0fce363
Add the notion of PaletteColor to use a color from the palette. Breaking change: most color styles are now methods rather than enum variants.
30 lines
745 B
Rust
30 lines
745 B
Rust
extern crate cursive;
|
|
|
|
use cursive::Cursive;
|
|
use cursive::views::{Dialog, TextView};
|
|
|
|
use cursive::theme::Color;
|
|
use cursive::theme::BaseColor;
|
|
use cursive::theme::Style;
|
|
use cursive::theme::Effect;
|
|
use cursive::utils::markup::StyledString;
|
|
|
|
fn main() {
|
|
let mut siv = Cursive::new();
|
|
|
|
let mut styled = StyledString::plain("Isn't ");
|
|
styled.append(StyledString::styled("that ", Color::Dark(BaseColor::Red)));
|
|
styled.append(StyledString::styled(
|
|
"cool?",
|
|
Style::from(Color::Light(BaseColor::Blue)).add(Effect::Bold),
|
|
));
|
|
|
|
// TextView can natively accept StyledString.
|
|
siv.add_layer(
|
|
Dialog::around(TextView::new(styled))
|
|
.button("Hell yeah!", |s| s.quit()),
|
|
);
|
|
|
|
siv.run();
|
|
}
|