diff --git a/crates/tek_core/src/tui.rs b/crates/tek_core/src/tui.rs index 59b697e9..52b32808 100644 --- a/crates/tek_core/src/tui.rs +++ b/crates/tek_core/src/tui.rs @@ -408,6 +408,9 @@ pub trait TuiStyle: Widget + Sized { fn background (self, color: Color) -> impl Widget { Layers::new(move |add|{ add(&Background(color))?; add(&self) }) } + fn border (self, style: impl BorderStyle) -> impl Widget { + Bordered(style, self) + } } impl> TuiStyle for W {} @@ -457,8 +460,19 @@ impl Widget for Border { Ok(()) } } +pub struct Bordered>(pub S, pub W); +impl> Content for Bordered { + type Engine = Tui; + fn content (&self) -> impl Widget { + let style = self.0; + Layers::new(move|add|{ + add(&Border(style))?; + add(&Inset::XY(1, 1, &self.1 as &dyn Widget)) + }).fill_xy() + } +} -pub trait BorderStyle: Send + Sync { +pub trait BorderStyle: Send + Sync + Copy { const NW: &'static str = ""; const N: &'static str = ""; const NE: &'static str = ""; @@ -553,6 +567,7 @@ macro_rules! border { const SE: &'static str = $se; $($x)* } + #[derive(Copy, Clone)] pub struct $T(pub Style); impl Widget for $T { type Engine = Tui; diff --git a/crates/tek_sequencer/src/sequencer.rs b/crates/tek_sequencer/src/sequencer.rs index 799735f4..11ead43b 100644 --- a/crates/tek_sequencer/src/sequencer.rs +++ b/crates/tek_sequencer/src/sequencer.rs @@ -1431,7 +1431,10 @@ impl Content for Sequencer { row!(toolbar, content) .fill_x() //.inset_x(1) - .background(Color::Rgb(50,40,30)) + .background(Color::Rgb(40,50,30)) + .border(Lozenge(Style::default() + .bg(Color::Rgb(40,50,30)) + .fg(Color::Rgb(70,80,50)))) } }