@@ -15,6 +15,10 @@ pub use crate::graphics::{Color, Modifier, Style};
15pub static DEFAULT_THEME: Lazy<Theme> = Lazy::new(|| {
15pub static DEFAULT_THEME: Lazy<Theme> = Lazy::new(|| {
16 toml::from_slice(include_bytes!("../../theme.toml")).expect("Failed to parse default theme")
16 toml::from_slice(include_bytes!("../../theme.toml")).expect("Failed to parse default theme")
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")
19#[derive(Clone, Debug)]
23#[derive(Clone, Debug)]
20pub struct Loader {
24pub struct Loader {
@@ -35,6 +39,9 @@ impl Loader {
35 if name == "default" {
39 if name == "default" {
36 return Ok(self.default());
40 return Ok(self.default());
42+ if name == "base16_default" {
43+ return Ok(self.base16_default());
38 let filename = format!("{}.toml", name);
45 let filename = format!("{}.toml", name);
40 let user_path = self.user_dir.join(&filename);
47 let user_path = self.user_dir.join(&filename);
@@ -74,6 +81,11 @@ impl Loader {
74 pub fn default(&self) -> Theme {
81 pub fn default(&self) -> Theme {
75 DEFAULT_THEME.clone()
82 DEFAULT_THEME.clone()
85+ /// Returns the alternative 16-color default theme
86+ pub fn base16_default(&self) -> Theme {
87+ BASE16_DEFAULT_THEME.clone()
79#[derive(Clone, Debug)]
91#[derive(Clone, Debug)]
@@ -154,6 +166,14 @@ impl Theme {
154 pub fn find_scope_index(&self, scope: &str) -> Option<usize> {
166 pub fn find_scope_index(&self, scope: &str) -> Option<usize> {
155 self.scopes().iter().position(|s| s == scope)
167 self.scopes().iter().position(|s| s == scope)
170+ pub fn is_16_color(&self) -> bool {
171+ self.styles.iter().all(|(_, style)| {
172+ [style.fg, style.bg]
174+ .all(|color| !matches!(color, Some(Color::Rgb(..))))
159struct ThemePalette {
179struct ThemePalette {