@@ -21,7 +21,7 @@ use crate::syntax_mapping::{MappingTarget, SyntaxMapping};
2121pub struct HighlightingAssets {
2222 syntax_set_cell: LazyCell<SyntaxSet>,
2323 serialized_syntax_set: Option<SerializedSyntaxSet>,
24− pub(crate) theme_set: ThemeSet,
24+ theme_set: ThemeSet,
2525 fallback_theme: Option<&'static str>,
2626}
2727
@@ -140,7 +140,11 @@ impl HighlightingAssets {
140140
141141 pub fn save_to_cache(&self, target_dir: &Path, current_version: &str) -> Result<()> {
142142 let _ = fs::create_dir_all(target_dir);
143− asset_to_cache(&self.theme_set, &target_dir.join("themes.bin"), "theme set")?;
143+ asset_to_cache(
144+ self.get_theme_set(),
145+ &target_dir.join("themes.bin"),
146+ "theme set",
147+ )?;
144148 asset_to_cache(
145149 self.get_syntax_set()?,
146150 &target_dir.join("syntaxes.bin"),
@@ -187,8 +191,12 @@ impl HighlightingAssets {
187191 Ok(self.get_syntax_set()?.syntaxes())
188192 }
189193
194+ fn get_theme_set(&self) -> &ThemeSet {
195+ &self.theme_set
196+ }
197+
190198 pub fn themes(&self) -> impl Iterator<Item = &str> {
191− self.theme_set.themes.keys().map(|s| s.as_ref())
199+ self.get_theme_set().themes.keys().map(|s| s.as_ref())
192200 }
193201
194202 /// Use [Self::get_syntax_for_file_name] instead
@@ -219,7 +227,7 @@ impl HighlightingAssets {
219227 }
220228
221229 pub(crate) fn get_theme(&self, theme: &str) -> &Theme {
222− match self.theme_set.themes.get(theme) {
230+ match self.get_theme_set().themes.get(theme) {
223231 Some(theme) => theme,
224232 None => {
225233 if theme == "ansi-light" || theme == "ansi-dark" {
@@ -229,7 +237,8 @@ impl HighlightingAssets {
229237 if !theme.is_empty() {
230238 bat_warning!("Unknown theme '{}', using default.", theme)
231239 }
232− &self.theme_set.themes[self.fallback_theme.unwrap_or_else(|| Self::default_theme())]
240+ &self.get_theme_set().themes
241+ [self.fallback_theme.unwrap_or_else(|| Self::default_theme())]
233242 }
234243 }
235244 }