Skip to content

Commit 8a1c03f

Browse files
author
Stephan Dilly
committed
one less public symbol
1 parent 6c733ef commit 8a1c03f

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

src/components/diff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ mod tests {
397397
false,
398398
false,
399399
false,
400-
crate::ui::style::DARK_THEME,
400+
Theme::default(),
401401
);
402402

403403
assert_eq!(text.len(), 2);

src/ui/style.rs

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,6 @@ pub struct Theme {
3838
commit_author: Color,
3939
}
4040

41-
pub const DARK_THEME: Theme = Theme {
42-
selected_tab: Color::Yellow,
43-
command_foreground: Color::White,
44-
command_background: Color::Rgb(0, 0, 100),
45-
command_disabled: Color::DarkGray,
46-
diff_line_add: Color::Green,
47-
diff_line_delete: Color::Red,
48-
diff_file_added: Color::LightGreen,
49-
diff_file_removed: Color::LightRed,
50-
diff_file_moved: Color::LightMagenta,
51-
diff_file_modified: Color::Yellow,
52-
commit_hash: Color::Magenta,
53-
commit_time: Color::Blue,
54-
commit_author: Color::Green,
55-
};
56-
5741
impl Theme {
5842
pub fn block(&self, focus: bool) -> Style {
5943
if focus {
@@ -196,8 +180,29 @@ impl Theme {
196180
if let Ok(x) = Theme::read_file(Theme::get_theme_file()) {
197181
x
198182
} else {
199-
DARK_THEME.save().unwrap_or_default();
200-
DARK_THEME
183+
let res = Self::default();
184+
res.save().unwrap_or_default();
185+
res
186+
}
187+
}
188+
}
189+
190+
impl Default for Theme {
191+
fn default() -> Self {
192+
Self {
193+
selected_tab: Color::Yellow,
194+
command_foreground: Color::White,
195+
command_background: Color::Rgb(0, 0, 100),
196+
command_disabled: Color::DarkGray,
197+
diff_line_add: Color::Green,
198+
diff_line_delete: Color::Red,
199+
diff_file_added: Color::LightGreen,
200+
diff_file_removed: Color::LightRed,
201+
diff_file_moved: Color::LightMagenta,
202+
diff_file_modified: Color::Yellow,
203+
commit_hash: Color::Magenta,
204+
commit_time: Color::Blue,
205+
commit_author: Color::Green,
201206
}
202207
}
203208
}

0 commit comments

Comments
 (0)