mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
refactor sequencer styles
This commit is contained in:
parent
6f988e5072
commit
6e81082c17
2 changed files with 48 additions and 77 deletions
|
|
@ -652,3 +652,15 @@ impl Theme for Nord {
|
|||
const PLAYING: Color = Color::Rgb(60, 100, 50);
|
||||
const SEPARATOR: Color = Color::Rgb(0, 0, 0);
|
||||
}
|
||||
|
||||
#[macro_export] macro_rules! tui_style {
|
||||
($NAME:ident = $fg:expr, $bg:expr, $ul:expr, $add:expr, $sub:expr) => {
|
||||
pub const $NAME: Style = Style {
|
||||
fg: $fg,
|
||||
bg: $bg,
|
||||
underline_color: $ul,
|
||||
add_modifier: $add,
|
||||
sub_modifier: $sub,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,64 +1,23 @@
|
|||
use crate::*;
|
||||
|
||||
const CORNERS: CornersTall = CornersTall(
|
||||
NOT_DIM_GREEN
|
||||
);
|
||||
pub const GRAY_DIM: Style = Style {
|
||||
fg: Some(Color::Gray),
|
||||
bg: None,
|
||||
underline_color: None,
|
||||
add_modifier: Modifier::DIM,
|
||||
sub_modifier: Modifier::empty(),
|
||||
};
|
||||
pub const GRAY_NOT_DIM_BOLD: Style = Style {
|
||||
fg: Some(Color::Gray),
|
||||
bg: None,
|
||||
underline_color: None,
|
||||
add_modifier: Modifier::BOLD,
|
||||
sub_modifier: Modifier::DIM,
|
||||
};
|
||||
pub const NOT_DIM_BOLD: Style = Style {
|
||||
fg: None,
|
||||
bg: None,
|
||||
underline_color: None,
|
||||
add_modifier: Modifier::BOLD,
|
||||
sub_modifier: Modifier::DIM,
|
||||
};
|
||||
pub const NOT_DIM_GREEN: Style = Style {
|
||||
fg: Some(Color::Rgb(96, 255, 32)),
|
||||
bg: Some(COLOR_BG1),
|
||||
underline_color: None,
|
||||
add_modifier: Modifier::empty(),
|
||||
sub_modifier: Modifier::DIM,
|
||||
};
|
||||
pub const NOT_DIM: Style = Style {
|
||||
fg: None,
|
||||
bg: None,
|
||||
underline_color: None,
|
||||
add_modifier: Modifier::empty(),
|
||||
sub_modifier: Modifier::DIM,
|
||||
};
|
||||
pub const WHITE_NOT_DIM_BOLD: Style = Style {
|
||||
fg: Some(Color::White),
|
||||
bg: None,
|
||||
underline_color: None,
|
||||
add_modifier: Modifier::BOLD,
|
||||
sub_modifier: Modifier::DIM,
|
||||
};
|
||||
const STYLE_LABEL: Option<Style> = Some(Style {
|
||||
fg: Some(Color::Reset),
|
||||
bg: None,
|
||||
underline_color: None,
|
||||
add_modifier: Modifier::empty(),
|
||||
sub_modifier: Modifier::BOLD,
|
||||
});
|
||||
const STYLE_VALUE: Option<Style> = Some(Style {
|
||||
fg: Some(Color::White),
|
||||
bg: None,
|
||||
underline_color: None,
|
||||
add_modifier: Modifier::BOLD,
|
||||
sub_modifier: Modifier::DIM,
|
||||
});
|
||||
const CORNERS: CornersTall = CornersTall(NOT_DIM_GREEN);
|
||||
|
||||
tui_style!(GRAY_DIM =
|
||||
Some(Color::Gray), None, None, Modifier::DIM, Modifier::empty());
|
||||
tui_style!(GRAY_NOT_DIM_BOLD =
|
||||
Some(Color::Gray), None, None, Modifier::BOLD, Modifier::DIM);
|
||||
tui_style!(NOT_DIM_BOLD =
|
||||
None, None, None, Modifier::BOLD, Modifier::DIM);
|
||||
tui_style!(NOT_DIM_GREEN =
|
||||
Some(Color::Rgb(96, 255, 32)), Some(COLOR_BG1), None, Modifier::empty(), Modifier::DIM);
|
||||
tui_style!(NOT_DIM =
|
||||
None, None, None, Modifier::empty(), Modifier::DIM);
|
||||
tui_style!(WHITE_NOT_DIM_BOLD =
|
||||
Some(Color::White), None, None, Modifier::BOLD, Modifier::DIM);
|
||||
tui_style!(STYLE_LABEL =
|
||||
Some(Color::Reset), None, None, Modifier::empty(), Modifier::BOLD);
|
||||
tui_style!(STYLE_VALUE =
|
||||
Some(Color::White), None, None, Modifier::BOLD, Modifier::DIM);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
@ -2078,8 +2037,8 @@ impl<'a> Widget for SequenceName<'a> {
|
|||
let [x, y, ..] = to.area();
|
||||
let frame = [x, y, 10, 4];
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(frame))?;
|
||||
to.blit(&"Name:", x + 1, y + 1, STYLE_LABEL);
|
||||
to.blit(&*self.0.name.read().unwrap(), x + 1, y + 2, STYLE_VALUE);
|
||||
to.blit(&"Name:", x + 1, y + 1, Some(STYLE_LABEL));
|
||||
to.blit(&*self.0.name.read().unwrap(), x + 1, y + 2, Some(STYLE_VALUE));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
@ -2097,10 +2056,10 @@ impl Widget for SequenceRange {
|
|||
let [x, y, ..] = to.area();
|
||||
let frame = [x, y, 10, 6];
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(frame))?;
|
||||
to.blit(&"Start: ", x + 1, y + 1, STYLE_LABEL);
|
||||
to.blit(&" 1.1.1", x + 1, y + 2, STYLE_VALUE);
|
||||
to.blit(&"End: ", x + 1, y + 3, STYLE_LABEL);
|
||||
to.blit(&" 2.1.1", x + 1, y + 4, STYLE_VALUE);
|
||||
to.blit(&"Start: ", x + 1, y + 1, Some(STYLE_LABEL));
|
||||
to.blit(&" 1.1.1", x + 1, y + 2, Some(STYLE_VALUE));
|
||||
to.blit(&"End: ", x + 1, y + 3, Some(STYLE_LABEL));
|
||||
to.blit(&" 2.1.1", x + 1, y + 4, Some(STYLE_VALUE));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
@ -2118,11 +2077,11 @@ impl Widget for SequenceLoopRange {
|
|||
let [x, y, ..] = to.area();
|
||||
let range = [x, y, 10, 7];
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(range))?;
|
||||
to.blit(&"Loop [ ]", x + 1, y + 1, STYLE_LABEL);
|
||||
to.blit(&"From: ", x + 1, y + 2, STYLE_LABEL);
|
||||
to.blit(&" 1.1.1", x + 1, y + 3, STYLE_VALUE);
|
||||
to.blit(&"Length: ", x + 1, y + 4, STYLE_LABEL);
|
||||
to.blit(&" 1.0.0", x + 1, y + 5, STYLE_VALUE);
|
||||
to.blit(&"Loop [ ]", x + 1, y + 1, Some(STYLE_LABEL));
|
||||
to.blit(&"From: ", x + 1, y + 2, Some(STYLE_LABEL));
|
||||
to.blit(&" 1.1.1", x + 1, y + 3, Some(STYLE_VALUE));
|
||||
to.blit(&"Length: ", x + 1, y + 4, Some(STYLE_LABEL));
|
||||
to.blit(&" 1.0.0", x + 1, y + 5, Some(STYLE_VALUE));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
@ -2140,13 +2099,13 @@ impl Widget for SequenceNoteRange {
|
|||
let [x, y, ..] = to.area();
|
||||
let range = [x, y, 10, 9];
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(range))?;
|
||||
to.blit(&"Notes: ", x + 1, y + 1, STYLE_LABEL);
|
||||
to.blit(&"C#0-C#9 ", x + 1, y + 2, STYLE_VALUE);
|
||||
to.blit(&"[ /2 ]", x + 1, y + 3, STYLE_LABEL);
|
||||
to.blit(&"[ x2 ]", x + 1, y + 4, STYLE_LABEL);
|
||||
to.blit(&"[ Rev ]", x + 1, y + 5, STYLE_LABEL);
|
||||
to.blit(&"[ Inv ]", x + 1, y + 6, STYLE_LABEL);
|
||||
to.blit(&"[ Dup ]", x + 1, y + 7, STYLE_LABEL);
|
||||
to.blit(&"Notes: ", x + 1, y + 1, Some(STYLE_LABEL));
|
||||
to.blit(&"C#0-C#9 ", x + 1, y + 2, Some(STYLE_VALUE));
|
||||
to.blit(&"[ /2 ]", x + 1, y + 3, Some(STYLE_LABEL));
|
||||
to.blit(&"[ x2 ]", x + 1, y + 4, Some(STYLE_LABEL));
|
||||
to.blit(&"[ Rev ]", x + 1, y + 5, Some(STYLE_LABEL));
|
||||
to.blit(&"[ Inv ]", x + 1, y + 6, Some(STYLE_LABEL));
|
||||
to.blit(&"[ Dup ]", x + 1, y + 7, Some(STYLE_LABEL));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue