Skip to content

Commit af99247

Browse files
authored
Merge pull request #86 from Romankivs/set-default-bg-ts-tokens
fix: use default bg color for tree-sitter tokens
2 parents a0eabfb + da14eb4 commit af99247

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/config.rs

+10
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ impl Config {
7777
Err(e) => return Err(format!("Unable to load config file: {e}")),
7878
};
7979

80+
cfg.set_default_bg_for_tokens();
8081
cfg.expand_home_dir_refs(&home);
8182

8283
Ok(cfg)
@@ -103,6 +104,15 @@ impl Config {
103104
Err("runtime config updates are not currently supported".to_owned())
104105
}
105106

107+
fn set_default_bg_for_tokens(&mut self) {
108+
for style in self.colorscheme.syntax.values_mut() {
109+
// Use default colorscheme's background color if none is specified
110+
if style.bg.is_none() {
111+
style.bg = Some(self.colorscheme.bg);
112+
}
113+
}
114+
}
115+
106116
fn expand_home_dir_refs(&mut self, home: &str) {
107117
for s in [
108118
&mut self.tree_sitter.parser_dir,

0 commit comments

Comments
 (0)