generate random color for each phrase

This commit is contained in:
🪞👃🪞 2024-10-10 19:55:27 +03:00
parent 79ee7081e6
commit 69a81106fc
4 changed files with 176 additions and 11 deletions

View file

@ -44,16 +44,18 @@ impl Handle<Tui> for Sequencer<Tui> {
impl Content for PhrasePool<Tui> {
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
let content = col!((i, _) in self.phrases.iter().enumerate() =>
Layers::new(|add|{
add(&format!(" {i}").fixed_y(2).bg(if i == self.phrase {
Color::Rgb(40, 50, 30)
} else {
Color::Rgb(28, 35, 25)
}))?;
if self.focused && i == self.phrase { add(&CORNERS)?; }
Ok(())
}))
let content = col!(
(i, phrase) in self.phrases.iter().enumerate() => Layers::new(|add|{
let color = phrase.read().unwrap().color;
add(&format!(" {i}").fixed_y(2).bg(if i == self.phrase {
color //Color::Rgb(40, 50, 30)
} else {
color //Color::Rgb(28, 35, 25)
}))?;
if self.focused && i == self.phrase { add(&CORNERS)?; }
Ok(())
})
)
.fill_xy()
.bg(Color::Rgb(28, 35, 25))
.border(Lozenge(Style::default()