diff options
Diffstat (limited to 'helix-term/src/theme.rs')
-rw-r--r-- | helix-term/src/theme.rs | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/helix-term/src/theme.rs b/helix-term/src/theme.rs index 0353f0e6..5b6eb7de 100644 --- a/helix-term/src/theme.rs +++ b/helix-term/src/theme.rs @@ -3,9 +3,38 @@ use tui::style::{Color, Style}; /// Color theme for syntax highlighting. pub struct Theme { + scopes: Vec<String>, mapping: HashMap<&'static str, Style>, } +// let highlight_names: Vec<String> = [ +// "attribute", +// "constant.builtin", +// "constant", +// "function.builtin", +// "function.macro", +// "function", +// "keyword", +// "operator", +// "property", +// "punctuation", +// "comment", +// "escape", +// "label", +// // "punctuation.bracket", +// "punctuation.delimiter", +// "string", +// "string.special", +// "tag", +// "type", +// "type.builtin", +// "constructor", +// "variable", +// "variable.builtin", +// "variable.parameter", +// "path", +// ]; + impl Default for Theme { fn default() -> Self { let mapping = hashmap! { @@ -45,7 +74,9 @@ impl Default for Theme { "function.builtin" => Style::default().fg(Color::Rgb(255, 0, 0)), // white }; - Self { mapping } + let scopes = mapping.keys().map(ToString::to_string).collect(); + + Self { mapping, scopes } } } @@ -56,4 +87,8 @@ impl Theme { .copied() .unwrap_or_else(|| Style::default().fg(Color::Rgb(0, 0, 255))) } + + pub fn scopes(&self) -> &[String] { + &self.scopes + } } |