use anyhow::Result; use gpui::{Hsla, Rgba}; use serde::Deserialize; use theme::{ StatusColorsRefinement, ThemeColorsRefinement, UserSyntaxTheme, UserTheme, UserThemeStylesRefinement, }; use crate::util::Traverse; use crate::vscode_syntax::VsCodeTokenColor; use crate::ThemeMetadata; #[derive(Deserialize, Debug)] pub struct VsCodeTheme { #[serde(rename = "$schema")] pub schema: Option, pub name: Option, pub author: Option, pub maintainers: Option>, #[serde(rename = "semanticClass")] pub semantic_class: Option, #[serde(rename = "semanticHighlighting")] pub semantic_highlighting: Option, pub colors: VsCodeColors, #[serde(rename = "tokenColors")] pub token_colors: Vec, } #[derive(Debug, Deserialize)] pub struct VsCodeColors { #[serde(rename = "terminal.background")] pub terminal_background: Option, #[serde(rename = "terminal.foreground")] pub terminal_foreground: Option, #[serde(rename = "terminal.ansiBrightBlack")] pub terminal_ansi_bright_black: Option, #[serde(rename = "terminal.ansiBrightRed")] pub terminal_ansi_bright_red: Option, #[serde(rename = "terminal.ansiBrightGreen")] pub terminal_ansi_bright_green: Option, #[serde(rename = "terminal.ansiBrightYellow")] pub terminal_ansi_bright_yellow: Option, #[serde(rename = "terminal.ansiBrightBlue")] pub terminal_ansi_bright_blue: Option, #[serde(rename = "terminal.ansiBrightMagenta")] pub terminal_ansi_bright_magenta: Option, #[serde(rename = "terminal.ansiBrightCyan")] pub terminal_ansi_bright_cyan: Option, #[serde(rename = "terminal.ansiBrightWhite")] pub terminal_ansi_bright_white: Option, #[serde(rename = "terminal.ansiBlack")] pub terminal_ansi_black: Option, #[serde(rename = "terminal.ansiRed")] pub terminal_ansi_red: Option, #[serde(rename = "terminal.ansiGreen")] pub terminal_ansi_green: Option, #[serde(rename = "terminal.ansiYellow")] pub terminal_ansi_yellow: Option, #[serde(rename = "terminal.ansiBlue")] pub terminal_ansi_blue: Option, #[serde(rename = "terminal.ansiMagenta")] pub terminal_ansi_magenta: Option, #[serde(rename = "terminal.ansiCyan")] pub terminal_ansi_cyan: Option, #[serde(rename = "terminal.ansiWhite")] pub terminal_ansi_white: Option, #[serde(rename = "focusBorder")] pub focus_border: Option, pub foreground: Option, #[serde(rename = "selection.background")] pub selection_background: Option, #[serde(rename = "errorForeground")] pub error_foreground: Option, #[serde(rename = "button.background")] pub button_background: Option, #[serde(rename = "button.foreground")] pub button_foreground: Option, #[serde(rename = "button.secondaryBackground")] pub button_secondary_background: Option, #[serde(rename = "button.secondaryForeground")] pub button_secondary_foreground: Option, #[serde(rename = "button.secondaryHoverBackground")] pub button_secondary_hover_background: Option, #[serde(rename = "dropdown.background")] pub dropdown_background: Option, #[serde(rename = "dropdown.border")] pub dropdown_border: Option, #[serde(rename = "dropdown.foreground")] pub dropdown_foreground: Option, #[serde(rename = "input.background")] pub input_background: Option, #[serde(rename = "input.foreground")] pub input_foreground: Option, #[serde(rename = "input.border")] pub input_border: Option, #[serde(rename = "input.placeholderForeground")] pub input_placeholder_foreground: Option, #[serde(rename = "inputOption.activeBorder")] pub input_option_active_border: Option, #[serde(rename = "inputValidation.infoBorder")] pub input_validation_info_border: Option, #[serde(rename = "inputValidation.warningBorder")] pub input_validation_warning_border: Option, #[serde(rename = "inputValidation.errorBorder")] pub input_validation_error_border: Option, #[serde(rename = "badge.foreground")] pub badge_foreground: Option, #[serde(rename = "badge.background")] pub badge_background: Option, #[serde(rename = "progressBar.background")] pub progress_bar_background: Option, #[serde(rename = "list.activeSelectionBackground")] pub list_active_selection_background: Option, #[serde(rename = "list.activeSelectionForeground")] pub list_active_selection_foreground: Option, #[serde(rename = "list.dropBackground")] pub list_drop_background: Option, #[serde(rename = "list.focusBackground")] pub list_focus_background: Option, #[serde(rename = "list.highlightForeground")] pub list_highlight_foreground: Option, #[serde(rename = "list.hoverBackground")] pub list_hover_background: Option, #[serde(rename = "list.inactiveSelectionBackground")] pub list_inactive_selection_background: Option, #[serde(rename = "list.warningForeground")] pub list_warning_foreground: Option, #[serde(rename = "list.errorForeground")] pub list_error_foreground: Option, #[serde(rename = "activityBar.background")] pub activity_bar_background: Option, #[serde(rename = "activityBar.inactiveForeground")] pub activity_bar_inactive_foreground: Option, #[serde(rename = "activityBar.foreground")] pub activity_bar_foreground: Option, #[serde(rename = "activityBar.activeBorder")] pub activity_bar_active_border: Option, #[serde(rename = "activityBar.activeBackground")] pub activity_bar_active_background: Option, #[serde(rename = "activityBarBadge.background")] pub activity_bar_badge_background: Option, #[serde(rename = "activityBarBadge.foreground")] pub activity_bar_badge_foreground: Option, #[serde(rename = "sideBar.background")] pub side_bar_background: Option, #[serde(rename = "sideBarTitle.foreground")] pub side_bar_title_foreground: Option, #[serde(rename = "sideBarSectionHeader.background")] pub side_bar_section_header_background: Option, #[serde(rename = "sideBarSectionHeader.border")] pub side_bar_section_header_border: Option, #[serde(rename = "editorGroup.border")] pub editor_group_border: Option, #[serde(rename = "editorGroup.dropBackground")] pub editor_group_drop_background: Option, #[serde(rename = "editorGroupHeader.tabsBackground")] pub editor_group_header_tabs_background: Option, #[serde(rename = "tab.activeBackground")] pub tab_active_background: Option, #[serde(rename = "tab.activeForeground")] pub tab_active_foreground: Option, #[serde(rename = "tab.border")] pub tab_border: Option, #[serde(rename = "tab.activeBorderTop")] pub tab_active_border_top: Option, #[serde(rename = "tab.inactiveBackground")] pub tab_inactive_background: Option, #[serde(rename = "tab.inactiveForeground")] pub tab_inactive_foreground: Option, #[serde(rename = "editor.foreground")] pub editor_foreground: Option, #[serde(rename = "editor.background")] pub editor_background: Option, #[serde(rename = "editorLineNumber.foreground")] pub editor_line_number_foreground: Option, #[serde(rename = "editor.selectionBackground")] pub editor_selection_background: Option, #[serde(rename = "editor.selectionHighlightBackground")] pub editor_selection_highlight_background: Option, #[serde(rename = "editor.foldBackground")] pub editor_fold_background: Option, #[serde(rename = "editor.wordHighlightBackground")] pub editor_word_highlight_background: Option, #[serde(rename = "editor.wordHighlightStrongBackground")] pub editor_word_highlight_strong_background: Option, #[serde(rename = "editor.findMatchBackground")] pub editor_find_match_background: Option, #[serde(rename = "editor.findMatchHighlightBackground")] pub editor_find_match_highlight_background: Option, #[serde(rename = "editor.findRangeHighlightBackground")] pub editor_find_range_highlight_background: Option, #[serde(rename = "editor.hoverHighlightBackground")] pub editor_hover_highlight_background: Option, #[serde(rename = "editor.lineHighlightBorder")] pub editor_line_highlight_border: Option, #[serde(rename = "editorLink.activeForeground")] pub editor_link_active_foreground: Option, #[serde(rename = "editor.rangeHighlightBackground")] pub editor_range_highlight_background: Option, #[serde(rename = "editor.snippetTabstopHighlightBackground")] pub editor_snippet_tabstop_highlight_background: Option, #[serde(rename = "editor.snippetTabstopHighlightBorder")] pub editor_snippet_tabstop_highlight_border: Option, #[serde(rename = "editor.snippetFinalTabstopHighlightBackground")] pub editor_snippet_final_tabstop_highlight_background: Option, #[serde(rename = "editor.snippetFinalTabstopHighlightBorder")] pub editor_snippet_final_tabstop_highlight_border: Option, #[serde(rename = "editorWhitespace.foreground")] pub editor_whitespace_foreground: Option, #[serde(rename = "editorIndentGuide.background")] pub editor_indent_guide_background: Option, #[serde(rename = "editorIndentGuide.activeBackground")] pub editor_indent_guide_active_background: Option, #[serde(rename = "editorRuler.foreground")] pub editor_ruler_foreground: Option, #[serde(rename = "editorCodeLens.foreground")] pub editor_code_lens_foreground: Option, #[serde(rename = "editorBracketHighlight.foreground1")] pub editor_bracket_highlight_foreground1: Option, #[serde(rename = "editorBracketHighlight.foreground2")] pub editor_bracket_highlight_foreground2: Option, #[serde(rename = "editorBracketHighlight.foreground3")] pub editor_bracket_highlight_foreground3: Option, #[serde(rename = "editorBracketHighlight.foreground4")] pub editor_bracket_highlight_foreground4: Option, #[serde(rename = "editorBracketHighlight.foreground5")] pub editor_bracket_highlight_foreground5: Option, #[serde(rename = "editorBracketHighlight.foreground6")] pub editor_bracket_highlight_foreground6: Option, #[serde(rename = "editorBracketHighlight.unexpectedBracket.foreground")] pub editor_bracket_highlight_unexpected_bracket_foreground: Option, #[serde(rename = "editorOverviewRuler.border")] pub editor_overview_ruler_border: Option, #[serde(rename = "editorOverviewRuler.selectionHighlightForeground")] pub editor_overview_ruler_selection_highlight_foreground: Option, #[serde(rename = "editorOverviewRuler.wordHighlightForeground")] pub editor_overview_ruler_word_highlight_foreground: Option, #[serde(rename = "editorOverviewRuler.wordHighlightStrongForeground")] pub editor_overview_ruler_word_highlight_strong_foreground: Option, #[serde(rename = "editorOverviewRuler.modifiedForeground")] pub editor_overview_ruler_modified_foreground: Option, #[serde(rename = "editorOverviewRuler.addedForeground")] pub editor_overview_ruler_added_foreground: Option, #[serde(rename = "editorOverviewRuler.deletedForeground")] pub editor_overview_ruler_deleted_foreground: Option, #[serde(rename = "editorOverviewRuler.errorForeground")] pub editor_overview_ruler_error_foreground: Option, #[serde(rename = "editorOverviewRuler.warningForeground")] pub editor_overview_ruler_warning_foreground: Option, #[serde(rename = "editorOverviewRuler.infoForeground")] pub editor_overview_ruler_info_foreground: Option, #[serde(rename = "editorError.foreground")] pub editor_error_foreground: Option, #[serde(rename = "editorWarning.foreground")] pub editor_warning_foreground: Option, #[serde(rename = "editorGutter.modifiedBackground")] pub editor_gutter_modified_background: Option, #[serde(rename = "editorGutter.addedBackground")] pub editor_gutter_added_background: Option, #[serde(rename = "editorGutter.deletedBackground")] pub editor_gutter_deleted_background: Option, #[serde(rename = "gitDecoration.modifiedResourceForeground")] pub git_decoration_modified_resource_foreground: Option, #[serde(rename = "gitDecoration.deletedResourceForeground")] pub git_decoration_deleted_resource_foreground: Option, #[serde(rename = "gitDecoration.untrackedResourceForeground")] pub git_decoration_untracked_resource_foreground: Option, #[serde(rename = "gitDecoration.ignoredResourceForeground")] pub git_decoration_ignored_resource_foreground: Option, #[serde(rename = "gitDecoration.conflictingResourceForeground")] pub git_decoration_conflicting_resource_foreground: Option, #[serde(rename = "diffEditor.insertedTextBackground")] pub diff_editor_inserted_text_background: Option, #[serde(rename = "diffEditor.removedTextBackground")] pub diff_editor_removed_text_background: Option, #[serde(rename = "inlineChat.regionHighlight")] pub inline_chat_region_highlight: Option, #[serde(rename = "editorWidget.background")] pub editor_widget_background: Option, #[serde(rename = "editorSuggestWidget.background")] pub editor_suggest_widget_background: Option, #[serde(rename = "editorSuggestWidget.foreground")] pub editor_suggest_widget_foreground: Option, #[serde(rename = "editorSuggestWidget.selectedBackground")] pub editor_suggest_widget_selected_background: Option, #[serde(rename = "editorHoverWidget.background")] pub editor_hover_widget_background: Option, #[serde(rename = "editorHoverWidget.border")] pub editor_hover_widget_border: Option, #[serde(rename = "editorMarkerNavigation.background")] pub editor_marker_navigation_background: Option, #[serde(rename = "peekView.border")] pub peek_view_border: Option, #[serde(rename = "peekViewEditor.background")] pub peek_view_editor_background: Option, #[serde(rename = "peekViewEditor.matchHighlightBackground")] pub peek_view_editor_match_highlight_background: Option, #[serde(rename = "peekViewResult.background")] pub peek_view_result_background: Option, #[serde(rename = "peekViewResult.fileForeground")] pub peek_view_result_file_foreground: Option, #[serde(rename = "peekViewResult.lineForeground")] pub peek_view_result_line_foreground: Option, #[serde(rename = "peekViewResult.matchHighlightBackground")] pub peek_view_result_match_highlight_background: Option, #[serde(rename = "peekViewResult.selectionBackground")] pub peek_view_result_selection_background: Option, #[serde(rename = "peekViewResult.selectionForeground")] pub peek_view_result_selection_foreground: Option, #[serde(rename = "peekViewTitle.background")] pub peek_view_title_background: Option, #[serde(rename = "peekViewTitleDescription.foreground")] pub peek_view_title_description_foreground: Option, #[serde(rename = "peekViewTitleLabel.foreground")] pub peek_view_title_label_foreground: Option, #[serde(rename = "merge.currentHeaderBackground")] pub merge_current_header_background: Option, #[serde(rename = "merge.incomingHeaderBackground")] pub merge_incoming_header_background: Option, #[serde(rename = "editorOverviewRuler.currentContentForeground")] pub editor_overview_ruler_current_content_foreground: Option, #[serde(rename = "editorOverviewRuler.incomingContentForeground")] pub editor_overview_ruler_incoming_content_foreground: Option, #[serde(rename = "panel.background")] pub panel_background: Option, #[serde(rename = "panel.border")] pub panel_border: Option, #[serde(rename = "panelTitle.activeBorder")] pub panel_title_active_border: Option, #[serde(rename = "panelTitle.activeForeground")] pub panel_title_active_foreground: Option, #[serde(rename = "panelTitle.inactiveForeground")] pub panel_title_inactive_foreground: Option, #[serde(rename = "statusBar.background")] pub status_bar_background: Option, #[serde(rename = "statusBar.foreground")] pub status_bar_foreground: Option, #[serde(rename = "statusBar.debuggingBackground")] pub status_bar_debugging_background: Option, #[serde(rename = "statusBar.debuggingForeground")] pub status_bar_debugging_foreground: Option, #[serde(rename = "statusBar.noFolderBackground")] pub status_bar_no_folder_background: Option, #[serde(rename = "statusBar.noFolderForeground")] pub status_bar_no_folder_foreground: Option, #[serde(rename = "statusBarItem.prominentBackground")] pub status_bar_item_prominent_background: Option, #[serde(rename = "statusBarItem.prominentHoverBackground")] pub status_bar_item_prominent_hover_background: Option, #[serde(rename = "statusBarItem.remoteForeground")] pub status_bar_item_remote_foreground: Option, #[serde(rename = "statusBarItem.remoteBackground")] pub status_bar_item_remote_background: Option, #[serde(rename = "titleBar.activeBackground")] pub title_bar_active_background: Option, #[serde(rename = "titleBar.activeForeground")] pub title_bar_active_foreground: Option, #[serde(rename = "titleBar.inactiveBackground")] pub title_bar_inactive_background: Option, #[serde(rename = "titleBar.inactiveForeground")] pub title_bar_inactive_foreground: Option, #[serde(rename = "extensionButton.prominentForeground")] pub extension_button_prominent_foreground: Option, #[serde(rename = "extensionButton.prominentBackground")] pub extension_button_prominent_background: Option, #[serde(rename = "extensionButton.prominentHoverBackground")] pub extension_button_prominent_hover_background: Option, #[serde(rename = "pickerGroup.border")] pub picker_group_border: Option, #[serde(rename = "pickerGroup.foreground")] pub picker_group_foreground: Option, #[serde(rename = "debugToolBar.background")] pub debug_tool_bar_background: Option, #[serde(rename = "walkThrough.embeddedEditorBackground")] pub walk_through_embedded_editor_background: Option, #[serde(rename = "settings.headerForeground")] pub settings_header_foreground: Option, #[serde(rename = "settings.modifiedItemIndicator")] pub settings_modified_item_indicator: Option, #[serde(rename = "settings.dropdownBackground")] pub settings_dropdown_background: Option, #[serde(rename = "settings.dropdownForeground")] pub settings_dropdown_foreground: Option, #[serde(rename = "settings.dropdownBorder")] pub settings_dropdown_border: Option, #[serde(rename = "settings.checkboxBackground")] pub settings_checkbox_background: Option, #[serde(rename = "settings.checkboxForeground")] pub settings_checkbox_foreground: Option, #[serde(rename = "settings.checkboxBorder")] pub settings_checkbox_border: Option, #[serde(rename = "settings.textInputBackground")] pub settings_text_input_background: Option, #[serde(rename = "settings.textInputForeground")] pub settings_text_input_foreground: Option, #[serde(rename = "settings.textInputBorder")] pub settings_text_input_border: Option, #[serde(rename = "settings.numberInputBackground")] pub settings_number_input_background: Option, #[serde(rename = "settings.numberInputForeground")] pub settings_number_input_foreground: Option, #[serde(rename = "settings.numberInputBorder")] pub settings_number_input_border: Option, #[serde(rename = "breadcrumb.foreground")] pub breadcrumb_foreground: Option, #[serde(rename = "breadcrumb.background")] pub breadcrumb_background: Option, #[serde(rename = "breadcrumb.focusForeground")] pub breadcrumb_focus_foreground: Option, #[serde(rename = "breadcrumb.activeSelectionForeground")] pub breadcrumb_active_selection_foreground: Option, #[serde(rename = "breadcrumbPicker.background")] pub breadcrumb_picker_background: Option, #[serde(rename = "listFilterWidget.background")] pub list_filter_widget_background: Option, #[serde(rename = "listFilterWidget.outline")] pub list_filter_widget_outline: Option, #[serde(rename = "listFilterWidget.noMatchesOutline")] pub list_filter_widget_no_matches_outline: Option, } pub(crate) fn try_parse_color(color: &str) -> Result { Ok(Rgba::try_from(color)?.into()) } pub struct VsCodeThemeConverter { theme: VsCodeTheme, theme_metadata: ThemeMetadata, } impl VsCodeThemeConverter { pub fn new(theme: VsCodeTheme, theme_metadata: ThemeMetadata) -> Self { Self { theme, theme_metadata, } } pub fn convert(self) -> Result { let appearance = self.theme_metadata.appearance.into(); let vscode_colors = &self.theme.colors; let status_color_refinements = StatusColorsRefinement { // conflict: None, // created: None, deleted: vscode_colors .error_foreground .as_ref() .traverse(|color| try_parse_color(&color))?, error: vscode_colors .error_foreground .as_ref() .traverse(|color| try_parse_color(&color))?, hidden: vscode_colors .tab_inactive_foreground .as_ref() .traverse(|color| try_parse_color(&color))?, // ignored: None, // info: None, // modified: None, // renamed: None, // success: None, warning: vscode_colors .list_warning_foreground .as_ref() .traverse(|color| try_parse_color(&color))?, ..Default::default() }; let theme_colors_refinements = ThemeColorsRefinement { border: vscode_colors .panel_border .as_ref() .traverse(|color| try_parse_color(&color))?, border_variant: vscode_colors .panel_border .as_ref() .traverse(|color| try_parse_color(&color))?, border_focused: vscode_colors .focus_border .as_ref() .traverse(|color| try_parse_color(&color))?, border_disabled: vscode_colors .panel_border .as_ref() .traverse(|color| try_parse_color(&color))?, border_selected: vscode_colors .panel_border .as_ref() .traverse(|color| try_parse_color(&color))?, border_transparent: vscode_colors .panel_border .as_ref() .traverse(|color| try_parse_color(&color))?, elevated_surface_background: vscode_colors .panel_background .as_ref() .traverse(|color| try_parse_color(&color))?, surface_background: vscode_colors .panel_background .as_ref() .traverse(|color| try_parse_color(&color))?, background: vscode_colors .editor_background .as_ref() .traverse(|color| try_parse_color(&color))?, element_background: vscode_colors .button_background .as_ref() .traverse(|color| try_parse_color(&color))?, element_hover: vscode_colors .list_hover_background .as_ref() .traverse(|color| try_parse_color(&color))?, element_selected: vscode_colors .list_active_selection_background .as_ref() .traverse(|color| try_parse_color(&color))?, ghost_element_hover: vscode_colors .list_hover_background .as_ref() .traverse(|color| try_parse_color(&color))?, drop_target_background: vscode_colors .list_drop_background .as_ref() .traverse(|color| try_parse_color(&color))?, text: vscode_colors .foreground .as_ref() .traverse(|color| try_parse_color(&color))?, tab_active_background: vscode_colors .tab_active_background .as_ref() .traverse(|color| try_parse_color(&color))?, tab_inactive_background: vscode_colors .tab_inactive_background .as_ref() .traverse(|color| try_parse_color(&color))?, editor_background: vscode_colors .editor_background .as_ref() .traverse(|color| try_parse_color(&color))?, editor_gutter_background: vscode_colors .editor_background .as_ref() .traverse(|color| try_parse_color(&color))?, editor_line_number: vscode_colors .editor_line_number_foreground .as_ref() .traverse(|color| try_parse_color(&color))?, editor_active_line_number: vscode_colors .editor_foreground .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_background: vscode_colors .terminal_background .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_bright_black: vscode_colors .terminal_ansi_bright_black .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_bright_red: vscode_colors .terminal_ansi_bright_red .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_bright_green: vscode_colors .terminal_ansi_bright_green .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_bright_yellow: vscode_colors .terminal_ansi_bright_yellow .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_bright_blue: vscode_colors .terminal_ansi_bright_blue .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_bright_magenta: vscode_colors .terminal_ansi_bright_magenta .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_bright_cyan: vscode_colors .terminal_ansi_bright_cyan .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_bright_white: vscode_colors .terminal_ansi_bright_white .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_black: vscode_colors .terminal_ansi_black .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_red: vscode_colors .terminal_ansi_red .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_green: vscode_colors .terminal_ansi_green .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_yellow: vscode_colors .terminal_ansi_yellow .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_blue: vscode_colors .terminal_ansi_blue .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_magenta: vscode_colors .terminal_ansi_magenta .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_cyan: vscode_colors .terminal_ansi_cyan .as_ref() .traverse(|color| try_parse_color(&color))?, terminal_ansi_white: vscode_colors .terminal_ansi_white .as_ref() .traverse(|color| try_parse_color(&color))?, ..Default::default() }; let mut highlight_styles = Vec::new(); for token_color in self.theme.token_colors { highlight_styles.extend(token_color.highlight_styles()?); } let syntax_theme = UserSyntaxTheme { highlights: highlight_styles, }; Ok(UserTheme { name: self.theme_metadata.name.into(), appearance, styles: UserThemeStylesRefinement { colors: theme_colors_refinements, status: status_color_refinements, syntax: Some(syntax_theme), }, }) } }