@@ -15,6 +15,10 @@ pub use crate::graphics::{Color, Modifier, Style};
1515pub static DEFAULT_THEME: Lazy<Theme> = Lazy::new(|| {
1616 toml::from_slice(include_bytes!("../../theme.toml")).expect("Failed to parse default theme")
1717});
18+pub static BASE16_DEFAULT_THEME: Lazy<Theme> = Lazy::new(|| {
19+ toml::from_slice(include_bytes!("../../base16_theme.toml"))
20+ .expect("Failed to parse base 16 default theme")
21+});
1822
1923#[derive(Clone, Debug)]
2024pub struct Loader {
@@ -35,6 +39,9 @@ impl Loader {
3539 if name == "default" {
3640 return Ok(self.default());
3741 }
42+ if name == "base16_default" {
43+ return Ok(self.base16_default());
44+ }
3845 let filename = format!("{}.toml", name);
3946
4047 let user_path = self.user_dir.join(&filename);
@@ -74,6 +81,11 @@ impl Loader {
7481 pub fn default(&self) -> Theme {
7582 DEFAULT_THEME.clone()
7683 }
84+
85+ /// Returns the alternative 16-color default theme
86+ pub fn base16_default(&self) -> Theme {
87+ BASE16_DEFAULT_THEME.clone()
88+ }
7789}
7890
7991#[derive(Clone, Debug)]
@@ -154,6 +166,14 @@ impl Theme {
154166 pub fn find_scope_index(&self, scope: &str) -> Option<usize> {
155167 self.scopes().iter().position(|s| s == scope)
156168 }
169+
170+ pub fn is_16_color(&self) -> bool {
171+ self.styles.iter().all(|(_, style)| {
172+ [style.fg, style.bg]
173+ .into_iter()
174+ .all(|color| !matches!(color, Some(Color::Rgb(..))))
175+ })
176+ }
157177}
158178
159179struct ThemePalette {