1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-14 17:22:25 +01:00

add theme option (#95)

closes #89
This commit is contained in:
Ryan Leung
2018-05-11 19:53:17 +08:00
committed by David Peter
parent f711fb5006
commit 22c8978fca
3 changed files with 29 additions and 6 deletions

View File

@@ -126,11 +126,13 @@ impl HighlightingAssets {
Ok(())
}
pub fn default_theme(&self) -> Result<&Theme> {
Ok(self.theme_set
.themes
.get("Default")
.ok_or_else(|| io::Error::new(io::ErrorKind::Other, "Could not find 'Default' theme"))?)
pub fn get_theme(&self, theme: &str) -> Result<&Theme> {
Ok(self.theme_set.themes.get(theme).ok_or_else(|| {
io::Error::new(
io::ErrorKind::Other,
format!("Could not find '{}' theme", theme),
)
})?)
}
}