mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-28 22:10:27 +08:00
lib: Fix and improve theming
This commit is contained in:
@@ -472,6 +472,7 @@ where
|
||||
.with_area(area)
|
||||
.with_layout(layout.into())
|
||||
.with_ctx(self.ctx.clone())
|
||||
.with_theme(self.theme.clone())
|
||||
}
|
||||
|
||||
pub fn layout<R>(
|
||||
|
||||
+7
-7
@@ -6,11 +6,11 @@ use ratatui::style::{Color, Style, Stylize};
|
||||
pub struct Theme {
|
||||
pub border_style: Style,
|
||||
pub focus_border_style: Style,
|
||||
pub scroll_style: Style,
|
||||
pub focus_scroll_style: Style,
|
||||
pub shortcuts_keys_style: Style,
|
||||
pub shortcuts_action_style: Style,
|
||||
pub textview_style: Style,
|
||||
pub textview_scroll_style: Style,
|
||||
pub textview_focus_scroll_style: Style,
|
||||
pub bar_on_black_style: Style,
|
||||
pub dim_no_focus: bool,
|
||||
}
|
||||
@@ -26,11 +26,11 @@ impl Theme {
|
||||
Self {
|
||||
border_style: Style::default().fg(Color::Rgb(170, 170, 170)),
|
||||
focus_border_style: Style::default(),
|
||||
scroll_style: Style::default().fg(Color::Rgb(170, 170, 170)),
|
||||
focus_scroll_style: Style::default(),
|
||||
shortcuts_keys_style: style::yellow(),
|
||||
shortcuts_action_style: style::reset(),
|
||||
textview_style: style::reset(),
|
||||
textview_scroll_style: style::cyan().dim(),
|
||||
textview_focus_scroll_style: style::cyan(),
|
||||
bar_on_black_style: Style::default().on_gray(),
|
||||
dim_no_focus: false,
|
||||
}
|
||||
@@ -39,12 +39,12 @@ impl Theme {
|
||||
pub fn default_dark() -> Self {
|
||||
Self {
|
||||
border_style: Style::default().fg(Color::Indexed(240)),
|
||||
focus_border_style: Style::default().fg(Color::Indexed(246)),
|
||||
focus_border_style: Style::default().cyan(),
|
||||
scroll_style: Style::default().fg(Color::Indexed(240)),
|
||||
focus_scroll_style: style::cyan(),
|
||||
shortcuts_keys_style: style::yellow().dim(),
|
||||
shortcuts_action_style: style::gray().dim(),
|
||||
textview_style: style::reset(),
|
||||
textview_scroll_style: style::cyan().dim(),
|
||||
textview_focus_scroll_style: style::cyan(),
|
||||
bar_on_black_style: Style::default().on_black(),
|
||||
dim_no_focus: false,
|
||||
}
|
||||
|
||||
+11
-6
@@ -572,10 +572,10 @@ where
|
||||
.track_symbol(None)
|
||||
.end_symbol(None)
|
||||
.thumb_symbol("┃")
|
||||
.style(if area_focus {
|
||||
Style::default()
|
||||
.style(if ui.has_focus {
|
||||
ui.theme.focus_scroll_style
|
||||
} else {
|
||||
Style::default().dim()
|
||||
ui.theme.scroll_style
|
||||
});
|
||||
|
||||
let mut state = ScrollbarState::default()
|
||||
@@ -739,7 +739,12 @@ where
|
||||
.begin_symbol(None)
|
||||
.track_symbol(None)
|
||||
.end_symbol(None)
|
||||
.thumb_symbol("┃"),
|
||||
.thumb_symbol("┃")
|
||||
.style(if area_focus {
|
||||
ui.theme.focus_scroll_style
|
||||
} else {
|
||||
ui.theme.scroll_style
|
||||
}),
|
||||
))
|
||||
.highlight_style(style::highlight(ui.has_focus))
|
||||
.style(tree_style)
|
||||
@@ -1016,9 +1021,9 @@ impl Widget for TextView<'_> {
|
||||
.end_symbol(None)
|
||||
.thumb_symbol("┃")
|
||||
.style(if area_focus {
|
||||
Style::default()
|
||||
ui.theme.focus_scroll_style
|
||||
} else {
|
||||
Style::default().dim()
|
||||
ui.theme.scroll_style
|
||||
});
|
||||
|
||||
let mut scroller_state = ScrollbarState::default()
|
||||
|
||||
Reference in New Issue
Block a user