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,283 +1,39 @@
use super::*;
use ratatui::style::Color;
use super::palette::Palette;
pub fn theme() -> ThemeColors {
let bg = Color::Rgb(255, 255, 255);
let off_white = Color::Rgb(245, 245, 247);
let surface = Color::Rgb(235, 235, 240);
let border = Color::Rgb(210, 210, 215);
let text = Color::Rgb(29, 29, 31);
let text_dim = Color::Rgb(110, 110, 115);
let text_muted = Color::Rgb(160, 160, 165);
let keyword = Color::Rgb(173, 61, 164);
let string = Color::Rgb(209, 47, 27);
let comment = Color::Rgb(112, 127, 52);
let number = Color::Rgb(39, 42, 216);
let types = Color::Rgb(112, 61, 170);
let function = Color::Rgb(62, 128, 135);
let preproc = Color::Rgb(120, 73, 42);
let accent = Color::Rgb(0, 112, 243);
ThemeColors {
ui: UiColors {
bg,
bg_rgb: (255, 255, 255),
text_primary: text,
text_muted: text_dim,
text_dim: text_muted,
border,
header: accent,
unfocused: text_muted,
accent,
surface,
},
status: StatusColors {
playing_bg: Color::Rgb(220, 240, 220),
playing_fg: comment,
stopped_bg: Color::Rgb(245, 220, 220),
stopped_fg: string,
fill_on: comment,
fill_off: text_muted,
fill_bg: surface,
},
selection: SelectionColors {
cursor_bg: accent,
cursor_fg: bg,
selected_bg: Color::Rgb(200, 220, 250),
selected_fg: accent,
in_range_bg: Color::Rgb(220, 233, 250),
in_range_fg: text,
cursor: accent,
selected: Color::Rgb(200, 220, 250),
in_range: Color::Rgb(220, 233, 250),
},
tile: TileColors {
playing_active_bg: Color::Rgb(250, 225, 210),
playing_active_fg: preproc,
playing_inactive_bg: Color::Rgb(250, 240, 200),
playing_inactive_fg: Color::Rgb(180, 140, 20),
active_bg: Color::Rgb(210, 235, 240),
active_fg: function,
content_bg: Color::Rgb(195, 225, 230),
inactive_bg: surface,
inactive_fg: text_dim,
active_selected_bg: Color::Rgb(210, 215, 245),
active_in_range_bg: Color::Rgb(220, 230, 245),
link_bright: [
(173, 61, 164),
(0, 112, 243),
(120, 73, 42),
(62, 128, 135),
(112, 127, 52),
],
link_dim: [
(235, 215, 235),
(210, 225, 250),
(240, 225, 210),
(215, 235, 240),
(225, 235, 215),
],
},
header: HeaderColors {
tempo_bg: Color::Rgb(225, 215, 240),
tempo_fg: types,
bank_bg: Color::Rgb(210, 230, 250),
bank_fg: accent,
pattern_bg: Color::Rgb(210, 235, 235),
pattern_fg: function,
stats_bg: surface,
stats_fg: text_dim,
},
modal: ModalColors {
border: accent,
border_accent: keyword,
border_warn: preproc,
border_dim: text_muted,
confirm: preproc,
rename: keyword,
input: accent,
editor: accent,
preview: text_muted,
},
flash: FlashColors {
error_bg: Color::Rgb(250, 215, 215),
error_fg: string,
success_bg: Color::Rgb(215, 240, 215),
success_fg: comment,
info_bg: surface,
info_fg: text,
},
list: ListColors {
playing_bg: Color::Rgb(215, 240, 220),
playing_fg: comment,
staged_play_bg: Color::Rgb(230, 215, 240),
staged_play_fg: keyword,
staged_stop_bg: Color::Rgb(245, 215, 220),
staged_stop_fg: string,
edit_bg: Color::Rgb(210, 235, 240),
edit_fg: function,
hover_bg: Color::Rgb(240, 240, 242),
hover_fg: text,
muted_bg: Color::Rgb(230, 230, 235),
muted_fg: text_muted,
soloed_bg: Color::Rgb(250, 240, 200),
soloed_fg: Color::Rgb(170, 130, 10),
},
link_status: LinkStatusColors {
disabled: string,
connected: comment,
listening: Color::Rgb(180, 140, 20),
},
syntax: SyntaxColors {
gap_bg: off_white,
executed_bg: Color::Rgb(230, 225, 245),
selected_bg: Color::Rgb(250, 240, 210),
emit: (text, Color::Rgb(250, 220, 215)),
number: (number, Color::Rgb(220, 220, 250)),
string: (string, Color::Rgb(250, 225, 220)),
comment: (Color::Rgb(130, 145, 75), off_white),
keyword: (keyword, Color::Rgb(240, 225, 240)),
stack_op: (accent, Color::Rgb(220, 235, 250)),
operator: (preproc, Color::Rgb(240, 230, 215)),
sound: (function, Color::Rgb(215, 240, 240)),
param: (types, Color::Rgb(230, 220, 240)),
context: (preproc, Color::Rgb(240, 230, 215)),
note: (comment, Color::Rgb(225, 240, 220)),
interval: (Color::Rgb(90, 110, 40), Color::Rgb(225, 240, 215)),
variable: (keyword, Color::Rgb(240, 225, 240)),
vary: (Color::Rgb(180, 140, 20), Color::Rgb(250, 240, 210)),
generator: (function, Color::Rgb(215, 240, 235)),
user_defined: (preproc, Color::Rgb(240, 230, 215)),
default: (text_dim, off_white),
},
table: TableColors {
row_even: off_white,
row_odd: bg,
},
values: ValuesColors {
tempo: preproc,
value: text_dim,
},
hint: HintColors {
key: accent,
text: text_muted,
},
view_badge: ViewBadgeColors { bg: text, fg: bg },
nav: NavColors {
selected_bg: Color::Rgb(210, 225, 250),
selected_fg: text,
unselected_bg: surface,
unselected_fg: text_muted,
},
editor_widget: EditorWidgetColors {
cursor_bg: text,
cursor_fg: bg,
selection_bg: Color::Rgb(200, 220, 250),
completion_bg: surface,
completion_fg: text,
completion_selected: accent,
completion_example: function,
},
browser: BrowserColors {
directory: accent,
project_file: keyword,
selected: preproc,
file: text,
focused_border: accent,
unfocused_border: text_muted,
root: text,
file_icon: text_muted,
folder_icon: accent,
empty_text: text_muted,
},
input: InputColors {
text: accent,
cursor: text,
hint: text_muted,
},
search: SearchColors {
active: accent,
inactive: text_muted,
match_bg: Color::Rgb(255, 230, 80),
match_fg: text,
},
markdown: MarkdownColors {
h1: accent,
h2: preproc,
h3: keyword,
code: comment,
code_border: Color::Rgb(200, 200, 205),
link: function,
link_url: Color::Rgb(150, 150, 155),
quote: text_muted,
text,
list: text,
},
engine: EngineColors {
header: accent,
header_focused: preproc,
divider: Color::Rgb(200, 200, 205),
scroll_indicator: Color::Rgb(180, 180, 185),
label: Color::Rgb(120, 120, 125),
label_focused: Color::Rgb(80, 80, 85),
label_dim: Color::Rgb(150, 150, 155),
value: Color::Rgb(60, 60, 65),
focused: preproc,
normal: text,
dim: Color::Rgb(180, 180, 185),
path: Color::Rgb(120, 120, 125),
border_magenta: keyword,
border_green: comment,
border_cyan: function,
separator: Color::Rgb(200, 200, 210),
hint_active: preproc,
hint_inactive: Color::Rgb(200, 200, 210),
},
dict: DictColors {
word_name: function,
word_bg: Color::Rgb(215, 235, 240),
alias: text_muted,
stack_sig: keyword,
description: text,
example: Color::Rgb(110, 110, 120),
category_focused: preproc,
category_selected: accent,
category_normal: text,
category_dimmed: Color::Rgb(180, 180, 185),
border_focused: preproc,
border_normal: Color::Rgb(200, 200, 205),
header_desc: Color::Rgb(100, 100, 110),
},
title: TitleColors {
big_title: accent,
author: types,
link: function,
license: preproc,
prompt: Color::Rgb(100, 100, 110),
subtitle: text,
},
meter: MeterColors {
low: comment,
mid: Color::Rgb(200, 150, 20),
high: string,
low_rgb: (112, 127, 52),
mid_rgb: (200, 150, 20),
high_rgb: (209, 47, 27),
},
sparkle: SparkleColors {
colors: [
(0, 112, 243),
(173, 61, 164),
(112, 127, 52),
(62, 128, 135),
(120, 73, 42),
],
},
confirm: ConfirmColors {
border: accent,
button_selected_bg: accent,
button_selected_fg: bg,
},
pub fn palette() -> Palette {
Palette {
bg: (255, 255, 255),
surface: (235, 235, 240),
surface2: (210, 210, 215),
fg: (29, 29, 31),
fg_dim: (110, 110, 115),
fg_muted: (160, 160, 165),
accent: (0, 112, 243),
red: (209, 47, 27),
green: (112, 127, 52),
yellow: (200, 150, 20),
blue: (0, 112, 243),
purple: (173, 61, 164), // keyword
cyan: (62, 128, 135), // function
orange: (120, 73, 42), // preproc
tempo_color: (112, 61, 170),
bank_color: (0, 112, 243),
pattern_color: (62, 128, 135),
title_accent: (0, 112, 243),
title_author: (112, 61, 170),
secondary: (120, 73, 42),
link_bright: [
(173, 61, 164), (0, 112, 243), (120, 73, 42),
(62, 128, 135), (112, 127, 52),
],
link_dim: [
(235, 215, 235), (210, 225, 250), (240, 225, 210),
(215, 235, 240), (225, 235, 215),
],
sparkle: [
(0, 112, 243), (173, 61, 164), (112, 127, 52),
(62, 128, 135), (120, 73, 42),
],
meter: [(112, 127, 52), (200, 150, 20), (209, 47, 27)],
}
}