enable theming of the command line syntax (#3606)

* enable theming of the command line syntax

* added missing flatshape, sorted flatshapes for easier reading.

* sorted flat shapes again and saved it this time

* added sample rwb.json syntax them file to docs
This commit is contained in:
Darren Schroeder
2021-06-11 14:17:43 -05:00
committed by GitHub
parent b9ca3b2039
commit 2846e3f5d9
7 changed files with 275 additions and 95 deletions

View File

@ -84,7 +84,12 @@ impl rustyline::highlight::Highlighter for Helper {
}
fn highlight<'l>(&self, line: &'l str, _pos: usize) -> Cow<'l, str> {
Painter::paint_string(line, &self.context.scope, &DefaultPalette {})
let cfg = &self.context.configs.lock();
if let Some(palette) = &cfg.syntax_config {
Painter::paint_string(line, &self.context.scope, palette)
} else {
Painter::paint_string(line, &self.context.scope, &DefaultPalette {})
}
}
fn highlight_char(&self, _line: &str, _pos: usize) -> bool {