From 6e81082c17ec1c522a9e95949a8799c3cfa31564 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Thu, 19 Sep 2024 00:19:05 +0300 Subject: [PATCH] refactor sequencer styles --- crates/tek_core/src/tui.rs | 12 +++ crates/tek_sequencer/src/sequencer.rs | 113 ++++++++------------------ 2 files changed, 48 insertions(+), 77 deletions(-) diff --git a/crates/tek_core/src/tui.rs b/crates/tek_core/src/tui.rs index a1710f5f..ee566963 100644 --- a/crates/tek_core/src/tui.rs +++ b/crates/tek_core/src/tui.rs @@ -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, + }; + } +} diff --git a/crates/tek_sequencer/src/sequencer.rs b/crates/tek_sequencer/src/sequencer.rs index 11ed70f8..d9755bff 100644 --- a/crates/tek_sequencer/src/sequencer.rs +++ b/crates/tek_sequencer/src/sequencer.rs @@ -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