Emit editor_foreground color from theme converter

This commit is contained in:
Marshall Bowers 2023-12-14 17:28:45 -05:00
parent 35838ae554
commit 8bac4e199d
13 changed files with 52 additions and 10 deletions

View file

@ -201,6 +201,7 @@ impl<'a> Debug for ThemeColorsRefinementPrinter<'a> {
self.0.scrollbar_track_background,
),
("scrollbar_track_border", self.0.scrollbar_track_border),
("editor_foreground", self.0.editor_foreground),
("editor_background", self.0.editor_background),
("editor_gutter_background", self.0.editor_gutter_background),
(

View file

@ -142,6 +142,16 @@ impl VsCodeThemeConverter {
.as_ref()
.traverse(|color| try_parse_color(&color))?;
let vscode_token_colors_foreground = self
.theme
.token_colors
.iter()
.find(|token_color| token_color.scope.is_none())
.and_then(|token_color| token_color.settings.foreground.as_ref())
.traverse(|color| try_parse_color(&color))
.ok()
.flatten();
Ok(ThemeColorsRefinement {
border: vscode_panel_border,
border_variant: vscode_panel_border,
@ -197,16 +207,7 @@ impl VsCodeThemeConverter {
.foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?
.or_else(|| {
self.theme
.token_colors
.iter()
.find(|token_color| token_color.scope.is_none())
.and_then(|token_color| token_color.settings.foreground.as_ref())
.traverse(|color| try_parse_color(&color))
.ok()
.flatten()
}),
.or(vscode_token_colors_foreground),
text_muted: vscode_colors
.tab_inactive_foreground
.as_ref()
@ -226,6 +227,11 @@ impl VsCodeThemeConverter {
.as_ref()
.traverse(|color| try_parse_color(&color))?
.or(vscode_editor_background),
editor_foreground: vscode_colors
.foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?
.or(vscode_token_colors_foreground),
editor_background: vscode_editor_background,
editor_gutter_background: vscode_editor_background,
editor_line_number: vscode_colors