Feat: refactoring codebase

This commit is contained in:
2026-02-16 16:26:57 +01:00
parent b60703aa16
commit 773c7bbd1c
25 changed files with 1047 additions and 5360 deletions

View File

@@ -1,282 +1,39 @@
use super::*;
use ratatui::style::Color;
use super::palette::Palette;
pub fn theme() -> ThemeColors {
let bg = Color::Rgb(26, 27, 38);
let bg_light = Color::Rgb(36, 40, 59);
let bg_lighter = Color::Rgb(52, 59, 88);
let fg = Color::Rgb(169, 177, 214);
let fg_dim = Color::Rgb(130, 140, 180);
let comment = Color::Rgb(86, 95, 137);
let blue = Color::Rgb(122, 162, 247);
let purple = Color::Rgb(187, 154, 247);
let green = Color::Rgb(158, 206, 106);
let red = Color::Rgb(247, 118, 142);
let orange = Color::Rgb(224, 175, 104);
let cyan = Color::Rgb(125, 207, 255);
let yellow = Color::Rgb(224, 175, 104);
let darker_bg = Color::Rgb(22, 23, 32);
ThemeColors {
ui: UiColors {
bg,
bg_rgb: (26, 27, 38),
text_primary: fg,
text_muted: fg_dim,
text_dim: comment,
border: bg_lighter,
header: blue,
unfocused: comment,
accent: purple,
surface: bg_light,
},
status: StatusColors {
playing_bg: Color::Rgb(45, 60, 50),
playing_fg: green,
stopped_bg: Color::Rgb(60, 40, 50),
stopped_fg: red,
fill_on: green,
fill_off: comment,
fill_bg: bg_light,
},
selection: SelectionColors {
cursor_bg: purple,
cursor_fg: bg,
selected_bg: Color::Rgb(70, 60, 90),
selected_fg: purple,
in_range_bg: Color::Rgb(55, 55, 75),
in_range_fg: fg,
cursor: purple,
selected: Color::Rgb(70, 60, 90),
in_range: Color::Rgb(55, 55, 75),
},
tile: TileColors {
playing_active_bg: Color::Rgb(70, 60, 45),
playing_active_fg: orange,
playing_inactive_bg: Color::Rgb(60, 60, 50),
playing_inactive_fg: yellow,
active_bg: Color::Rgb(45, 60, 75),
active_fg: blue,
content_bg: Color::Rgb(52, 67, 82),
inactive_bg: bg_light,
inactive_fg: fg_dim,
active_selected_bg: Color::Rgb(70, 55, 85),
active_in_range_bg: Color::Rgb(55, 55, 75),
link_bright: [
(247, 118, 142),
(187, 154, 247),
(224, 175, 104),
(125, 207, 255),
(158, 206, 106),
],
link_dim: [
(80, 45, 55),
(65, 55, 85),
(75, 60, 40),
(45, 70, 85),
(55, 70, 45),
],
},
header: HeaderColors {
tempo_bg: Color::Rgb(65, 50, 70),
tempo_fg: purple,
bank_bg: Color::Rgb(45, 55, 75),
bank_fg: blue,
pattern_bg: Color::Rgb(50, 65, 50),
pattern_fg: green,
stats_bg: bg_light,
stats_fg: fg_dim,
},
modal: ModalColors {
border: blue,
border_accent: purple,
border_warn: orange,
border_dim: comment,
confirm: orange,
rename: purple,
input: blue,
editor: blue,
preview: comment,
},
flash: FlashColors {
error_bg: Color::Rgb(65, 40, 50),
error_fg: red,
success_bg: Color::Rgb(45, 60, 45),
success_fg: green,
info_bg: bg_light,
info_fg: fg,
},
list: ListColors {
playing_bg: Color::Rgb(45, 60, 45),
playing_fg: green,
staged_play_bg: Color::Rgb(60, 50, 75),
staged_play_fg: purple,
staged_stop_bg: Color::Rgb(70, 45, 55),
staged_stop_fg: red,
edit_bg: Color::Rgb(45, 55, 70),
edit_fg: blue,
hover_bg: bg_lighter,
hover_fg: fg,
muted_bg: Color::Rgb(35, 38, 50),
muted_fg: comment,
soloed_bg: Color::Rgb(60, 55, 40),
soloed_fg: yellow,
},
link_status: LinkStatusColors {
disabled: red,
connected: green,
listening: yellow,
},
syntax: SyntaxColors {
gap_bg: darker_bg,
executed_bg: Color::Rgb(45, 45, 60),
selected_bg: Color::Rgb(70, 60, 50),
emit: (fg, Color::Rgb(70, 50, 65)),
number: (purple, Color::Rgb(55, 50, 70)),
string: (green, Color::Rgb(50, 60, 50)),
comment: (comment, darker_bg),
keyword: (purple, Color::Rgb(60, 50, 70)),
stack_op: (cyan, Color::Rgb(45, 60, 75)),
operator: (red, Color::Rgb(65, 45, 55)),
sound: (blue, Color::Rgb(45, 55, 70)),
param: (orange, Color::Rgb(70, 55, 45)),
context: (orange, Color::Rgb(70, 55, 45)),
note: (green, Color::Rgb(50, 60, 45)),
interval: (Color::Rgb(180, 220, 130), Color::Rgb(50, 65, 45)),
variable: (green, Color::Rgb(50, 60, 45)),
vary: (yellow, Color::Rgb(70, 60, 45)),
generator: (cyan, Color::Rgb(45, 60, 75)),
user_defined: (orange, Color::Rgb(60, 50, 35)),
default: (fg_dim, darker_bg),
},
table: TableColors {
row_even: darker_bg,
row_odd: bg,
},
values: ValuesColors {
tempo: orange,
value: fg_dim,
},
hint: HintColors {
key: orange,
text: comment,
},
view_badge: ViewBadgeColors { bg: fg, fg: bg },
nav: NavColors {
selected_bg: Color::Rgb(65, 55, 80),
selected_fg: fg,
unselected_bg: bg_light,
unselected_fg: comment,
},
editor_widget: EditorWidgetColors {
cursor_bg: fg,
cursor_fg: bg,
selection_bg: Color::Rgb(60, 60, 80),
completion_bg: bg_light,
completion_fg: fg,
completion_selected: orange,
completion_example: cyan,
},
browser: BrowserColors {
directory: blue,
project_file: purple,
selected: orange,
file: fg,
focused_border: orange,
unfocused_border: comment,
root: fg,
file_icon: comment,
folder_icon: blue,
empty_text: comment,
},
input: InputColors {
text: blue,
cursor: fg,
hint: comment,
},
search: SearchColors {
active: orange,
inactive: comment,
match_bg: yellow,
match_fg: bg,
},
markdown: MarkdownColors {
h1: blue,
h2: orange,
h3: purple,
code: green,
code_border: Color::Rgb(70, 75, 95),
link: red,
link_url: Color::Rgb(110, 120, 160),
quote: comment,
text: fg,
list: fg,
},
engine: EngineColors {
header: blue,
header_focused: yellow,
divider: Color::Rgb(65, 70, 90),
scroll_indicator: Color::Rgb(80, 85, 110),
label: Color::Rgb(130, 140, 175),
label_focused: Color::Rgb(160, 170, 200),
label_dim: Color::Rgb(100, 110, 145),
value: Color::Rgb(190, 195, 220),
focused: yellow,
normal: fg,
dim: Color::Rgb(80, 85, 110),
path: Color::Rgb(130, 140, 175),
border_magenta: purple,
border_green: green,
border_cyan: cyan,
separator: Color::Rgb(65, 70, 90),
hint_active: Color::Rgb(210, 180, 100),
hint_inactive: Color::Rgb(65, 70, 90),
},
dict: DictColors {
word_name: green,
word_bg: Color::Rgb(45, 55, 60),
alias: comment,
stack_sig: purple,
description: fg,
example: Color::Rgb(130, 140, 175),
category_focused: yellow,
category_selected: blue,
category_normal: fg,
category_dimmed: Color::Rgb(80, 85, 110),
border_focused: yellow,
border_normal: Color::Rgb(65, 70, 90),
header_desc: Color::Rgb(150, 160, 190),
},
title: TitleColors {
big_title: purple,
author: blue,
link: green,
license: orange,
prompt: Color::Rgb(150, 160, 190),
subtitle: fg,
},
meter: MeterColors {
low: green,
mid: yellow,
high: red,
low_rgb: (158, 206, 106),
mid_rgb: (224, 175, 104),
high_rgb: (247, 118, 142),
},
sparkle: SparkleColors {
colors: [
(125, 207, 255),
(224, 175, 104),
(158, 206, 106),
(247, 118, 142),
(187, 154, 247),
],
},
confirm: ConfirmColors {
border: orange,
button_selected_bg: orange,
button_selected_fg: bg,
},
pub fn palette() -> Palette {
Palette {
bg: (26, 27, 38),
surface: (36, 40, 59),
surface2: (52, 59, 88),
fg: (169, 177, 214),
fg_dim: (130, 140, 180),
fg_muted: (86, 95, 137),
accent: (187, 154, 247), // purple
red: (247, 118, 142),
green: (158, 206, 106),
yellow: (224, 175, 104),
blue: (122, 162, 247),
purple: (187, 154, 247),
cyan: (125, 207, 255),
orange: (224, 175, 104),
tempo_color: (187, 154, 247),
bank_color: (122, 162, 247),
pattern_color: (158, 206, 106),
title_accent: (187, 154, 247),
title_author: (122, 162, 247),
secondary: (224, 175, 104),
link_bright: [
(247, 118, 142), (187, 154, 247), (224, 175, 104),
(125, 207, 255), (158, 206, 106),
],
link_dim: [
(80, 45, 55), (65, 55, 85), (75, 60, 40),
(45, 70, 85), (55, 70, 45),
],
sparkle: [
(125, 207, 255), (224, 175, 104), (158, 206, 106),
(247, 118, 142), (187, 154, 247),
],
meter: [(158, 206, 106), (224, 175, 104), (247, 118, 142)],
}
}