feat: Added the Eldritch theme and updated documentation

This commit is contained in:
2025-03-10 15:49:40 -06:00
parent 0834802481
commit b4ff5f3351
24 changed files with 214 additions and 103 deletions
-2
View File
@@ -33,8 +33,6 @@ use crate::ui::{ui, THEME};
use crate::utils::load_theme_config;
mod app;
mod builtin_themes;
mod builtin_themes_tests;
mod cli;
mod event;
mod handlers;
@@ -6,8 +6,8 @@ use std::str::FromStr;
#[path = "builtin_themes_tests.rs"]
mod builtin_themes_tests;
pub fn get_builtin_themes() -> Vec<ThemeDefinition> {
let watermelon_dark = Theme {
pub(in crate::ui) fn watermelon_dark_theme() -> Theme {
Theme {
background: Some(Background {
enabled: Some(false),
color: Some(Color::from_str("#233237").unwrap()),
@@ -31,11 +31,14 @@ pub fn get_builtin_themes() -> Vec<ThemeDefinition> {
color: Some(Color::from_str("#8c19ff").unwrap()),
}),
..Theme::default()
};
let dracula = Theme {
}
}
pub(in crate::ui) fn dracula_theme() -> Theme {
Theme {
background: Some(Background {
enabled: Some(false),
color: Some(Color::from_str("#233237").unwrap()),
enabled: Some(true),
color: Some(Color::from_str("#232326").unwrap()),
}),
default: Some(Style {
color: Some(Color::from_str("#f8f8f2").unwrap()),
@@ -74,7 +77,56 @@ pub fn get_builtin_themes() -> Vec<ThemeDefinition> {
color: Some(Color::from_str("#f8f8f2").unwrap()),
}),
..Theme::default()
};
}
}
pub(in crate::ui) fn eldritch_theme() -> Theme {
Theme {
background: Some(Background {
enabled: Some(true),
color: Some(Color::from_str("#212337").unwrap()),
}),
default: Some(Style {
color: Some(Color::from_str("#ebfafa").unwrap()),
}),
downloaded: Some(Style {
color: Some(Color::from_str("#37f499").unwrap()),
}),
downloading: Some(Style {
color: Some(Color::from_str("#f7c67f").unwrap()),
}),
failure: Some(Style {
color: Some(Color::from_str("#f16c75").unwrap()),
}),
missing: Some(Style {
color: Some(Color::from_str("#f7c67f").unwrap()),
}),
unmonitored_missing: Some(Style {
color: Some(Color::from_str("#7081d0").unwrap()),
}),
help: Some(Style {
color: Some(Color::from_str("#7081d0").unwrap()),
}),
primary: Some(Style {
color: Some(Color::from_str("#f265b5").unwrap()),
}),
secondary: Some(Style {
color: Some(Color::from_str("#04d1f9").unwrap()),
}),
success: Some(Style {
color: Some(Color::from_str("#37f499").unwrap()),
}),
warning: Some(Style {
color: Some(Color::from_str("#f1fc79").unwrap()),
}),
unreleased: Some(Style {
color: Some(Color::from_str("#ebfafa").unwrap()),
}),
..Theme::default()
}
}
pub fn get_builtin_themes() -> Vec<ThemeDefinition> {
vec![
ThemeDefinition {
name: "default".to_owned(),
@@ -82,11 +134,15 @@ pub fn get_builtin_themes() -> Vec<ThemeDefinition> {
},
ThemeDefinition {
name: "watermelon-dark".to_owned(),
theme: watermelon_dark,
theme: watermelon_dark_theme(),
},
ThemeDefinition {
name: "dracula".to_owned(),
theme: dracula,
theme: dracula_theme(),
},
ThemeDefinition {
name: "eldritch".to_owned(),
theme: eldritch_theme(),
},
]
}
@@ -1,6 +1,6 @@
#[cfg(test)]
mod test {
use crate::builtin_themes::get_builtin_themes;
use crate::ui::builtin_themes::get_builtin_themes;
use crate::ui::theme::{Background, Style, Theme, ThemeDefinition};
use pretty_assertions::assert_eq;
use ratatui::prelude::Color;
@@ -35,8 +35,8 @@ mod test {
};
let dracula = Theme {
background: Some(Background {
enabled: Some(false),
color: Some(Color::from_str("#233237").unwrap()),
enabled: Some(true),
color: Some(Color::from_str("#232326").unwrap()),
}),
default: Some(Style {
color: Some(Color::from_str("#f8f8f2").unwrap()),
@@ -76,6 +76,49 @@ mod test {
}),
..Theme::default()
};
let eldritch = Theme {
background: Some(Background {
enabled: Some(true),
color: Some(Color::from_str("#212337").unwrap()),
}),
default: Some(Style {
color: Some(Color::from_str("#ebfafa").unwrap()),
}),
downloaded: Some(Style {
color: Some(Color::from_str("#37f499").unwrap()),
}),
downloading: Some(Style {
color: Some(Color::from_str("#f7c67f").unwrap()),
}),
failure: Some(Style {
color: Some(Color::from_str("#f16c75").unwrap()),
}),
missing: Some(Style {
color: Some(Color::from_str("#f7c67f").unwrap()),
}),
unmonitored_missing: Some(Style {
color: Some(Color::from_str("#7081d0").unwrap()),
}),
help: Some(Style {
color: Some(Color::from_str("#7081d0").unwrap()),
}),
primary: Some(Style {
color: Some(Color::from_str("#f265b5").unwrap()),
}),
secondary: Some(Style {
color: Some(Color::from_str("#04d1f9").unwrap()),
}),
success: Some(Style {
color: Some(Color::from_str("#37f499").unwrap()),
}),
warning: Some(Style {
color: Some(Color::from_str("#f1fc79").unwrap()),
}),
unreleased: Some(Style {
color: Some(Color::from_str("#ebfafa").unwrap()),
}),
..Theme::default()
};
let expected_themes = vec![
ThemeDefinition {
name: "default".to_owned(),
@@ -89,6 +132,10 @@ mod test {
name: "dracula".to_owned(),
theme: dracula,
},
ThemeDefinition {
name: "eldritch".to_owned(),
theme: eldritch,
},
];
assert_eq!(expected_themes, get_builtin_themes());
+1
View File
@@ -24,6 +24,7 @@ use crate::ui::utils::{
use crate::ui::widgets::input_box::InputBox;
use crate::ui::widgets::popup::Size;
mod builtin_themes;
mod radarr_ui;
mod sonarr_ui;
mod styles;
+3 -3
View File
@@ -256,7 +256,7 @@ fn draw_movie_history(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
Cell::from(quality.quality.name.to_owned()),
Cell::from(date.to_string()),
])
.success()
.primary()
};
let help_footer = app
.data
@@ -297,7 +297,7 @@ fn draw_movie_cast(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
Cell::from(person_name.to_owned()),
Cell::from(character.clone().unwrap_or_default()),
])
.success()
.primary()
};
let content = Some(&mut movie_details_modal.movie_cast);
let help_footer = app
@@ -340,7 +340,7 @@ fn draw_movie_crew(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
Cell::from(job.clone().unwrap_or_default()),
Cell::from(department.clone().unwrap_or_default()),
])
.success()
.primary()
};
let content = Some(&mut movie_details_modal.movie_crew);
let help_footer = app
+1 -1
View File
@@ -1,4 +1,4 @@
use crate::builtin_themes::get_builtin_themes;
use crate::ui::builtin_themes::get_builtin_themes;
use anyhow::Result;
use derivative::Derivative;
use ratatui::style::Color;
+7 -71
View File
@@ -1,8 +1,8 @@
mod tests {
use crate::ui::builtin_themes::{dracula_theme, eldritch_theme, watermelon_dark_theme};
use crate::ui::theme::{Background, Style, Theme, ThemeDefinition, ThemeDefinitionsWrapper};
use pretty_assertions::{assert_eq, assert_str_eq};
use ratatui::style::Color;
use std::str::FromStr;
#[test]
fn test_background_default() {
@@ -192,74 +192,6 @@ warning:
#[test]
fn test_theme_definitions_wrapper_default() {
let watermelon_dark = Theme {
background: Some(Background {
enabled: Some(false),
color: Some(Color::from_str("#233237").unwrap()),
}),
default: Some(Style {
color: Some(Color::from_str("#00FF00").unwrap()),
}),
downloaded: Some(Style {
color: Some(Color::from_str("#80ffbf").unwrap()),
}),
failure: Some(Style {
color: Some(Color::from_str("#ff8080").unwrap()),
}),
missing: Some(Style {
color: Some(Color::from_str("#ff8080").unwrap()),
}),
primary: Some(Style {
color: Some(Color::from_str("#ff19d9").unwrap()),
}),
secondary: Some(Style {
color: Some(Color::from_str("#8c19ff").unwrap()),
}),
..Theme::default()
};
let dracula = Theme {
background: Some(Background {
enabled: Some(false),
color: Some(Color::from_str("#233237").unwrap()),
}),
default: Some(Style {
color: Some(Color::from_str("#f8f8f2").unwrap()),
}),
downloaded: Some(Style {
color: Some(Color::from_str("#50fa7b").unwrap()),
}),
downloading: Some(Style {
color: Some(Color::from_str("#f1fa8c").unwrap()),
}),
failure: Some(Style {
color: Some(Color::from_str("#ff5555").unwrap()),
}),
missing: Some(Style {
color: Some(Color::from_str("#ffb86c").unwrap()),
}),
primary: Some(Style {
color: Some(Color::from_str("#ff79c6").unwrap()),
}),
secondary: Some(Style {
color: Some(Color::from_str("#ff79c6").unwrap()),
}),
unmonitored_missing: Some(Style {
color: Some(Color::from_str("#6272a4").unwrap()),
}),
help: Some(Style {
color: Some(Color::from_str("#6272a4").unwrap()),
}),
success: Some(Style {
color: Some(Color::from_str("#50fa7b").unwrap()),
}),
warning: Some(Style {
color: Some(Color::from_str("#f1fa8c").unwrap()),
}),
unreleased: Some(Style {
color: Some(Color::from_str("#f8f8f2").unwrap()),
}),
..Theme::default()
};
let theme_definitions_wrapper = ThemeDefinitionsWrapper {
theme_definitions: vec![
ThemeDefinition {
@@ -268,11 +200,15 @@ warning:
},
ThemeDefinition {
name: "watermelon-dark".to_owned(),
theme: watermelon_dark,
theme: watermelon_dark_theme(),
},
ThemeDefinition {
name: "dracula".to_owned(),
theme: dracula,
theme: dracula_theme(),
},
ThemeDefinition {
name: "eldritch".to_owned(),
theme: eldritch_theme(),
},
],
};