-
Notifications
You must be signed in to change notification settings - Fork 247
Theming
Alexandre Bury edited this page Aug 2, 2019
·
1 revision
This can be solved with a special wrapper view that gives a differently themed printer to the child.
This can be solved by enabling custom entries in the palette. We probably want type indexing rather than literal. Eg:
# In cursive
trait CustomEntry {
const NAME: &str;
}
# In some 3rd-party lib
struct MyCoolColor;
impl cursive::CustomEntry for MyCoolColor {
const NAME: &str = "my_cool_color";
}
struct MyCoolView;
impl cursive::View for MyCoolView {
fn draw(&self, printer: &cursive::Printer) {
printer.with_color(cursive::theme::ColorStyle::custom(MyCoolColor), |printer| {
printer.print((0, 0), "Cool!");
});
}
}