Skip to content

Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.

feat: add /theme command to help screen and dynamically derive logo colors from active theme

Samir Hossainsb1945a8ff33d
diff --git a/src/tui/screens/help.rs b/src/tui/screens/help.rs
index a8e1cec..92e55e1 100644
--- a/src/tui/screens/help.rs
+++ b/src/tui/screens/help.rs
@@ -100,6 +100,10 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &AppState, theme: &Theme) {
Span::styled(" /clear-cache ", theme.header),
Span::styled("Clear App Cache", theme.text),
]),
+ Line::from(vec![
+ Span::styled(" /theme ", theme.header),
+ Span::styled("Change UI Theme", theme.text),
+ ]),
]);
} else {
help_text.extend(vec![
@@ -169,6 +173,10 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &AppState, theme: &Theme) {
Span::styled(" /clear-cache ", theme.header),
Span::styled("Clear App Cache", theme.text),
]),
+ Line::from(vec![
+ Span::styled(" /theme ", theme.header),
+ Span::styled("Change UI Theme", theme.text),
+ ]),
]);
}
diff --git a/src/tui/screens/home.rs b/src/tui/screens/home.rs
index 39507d3..872b180 100644
--- a/src/tui/screens/home.rs
+++ b/src/tui/screens/home.rs
@@ -1158,9 +1158,15 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
}
fn logo_fade_colors(theme: &Theme) -> ((f32, f32, f32), (f32, f32, f32)) {
- if theme.is_light {
- ((172.0, 176.0, 190.0), (136.0, 57.0, 239.0))
- } else {
- ((73.0, 76.0, 94.0), (203.0, 166.0, 247.0))
- }
+ let get_rgb = |style: ratatui::style::Style, default: (f32, f32, f32)| {
+ if let Some(ratatui::style::Color::Rgb(r, g, b)) = style.fg {
+ (r as f32, g as f32, b as f32)
+ } else {
+ default
+ }
+ };
+
+ let start = get_rgb(theme.surface1, (73.0, 76.0, 94.0));
+ let end = get_rgb(theme.title, (203.0, 166.0, 247.0));
+ (start, end)
}