diff options
Diffstat (limited to '')
| -rw-r--r-- | src/panes/code_view.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/panes/code_view.rs b/src/panes/code_view.rs index 7712d4d..956eb87 100644 --- a/src/panes/code_view.rs +++ b/src/panes/code_view.rs @@ -1,12 +1,23 @@ +use iced::advanced::text::highlighter::Format; use iced::widget::{button, pane_grid, row, text, text_editor, Space}; use iced::{Alignment, Background, Border, Font, Length, Theme}; -use iced_custom_highlighter::{Highlight, Highlighter, Settings}; +use iced_custom_highlighter::{Highlight, Highlighter, Scope, Settings}; use super::style; use crate::icon::copy; use crate::types::{DesignerPage, Message}; use crate::widget::tip; +fn highlight_style(theme: &Theme, scope: &Scope) -> Format<Font> { + match scope { + Scope::Custom { .. } | Scope::Other => Format { + color: Some(theme.extended_palette().primary.strong.color), + font: None, + }, + _ => Highlight::default_style(theme, scope), + } +} + pub fn view( editor_content: &text_editor::Content, theme: Theme, @@ -33,7 +44,7 @@ pub fn view( .on_action(Message::EditorAction) .font(Font::MONOSPACE) .highlight_with::<Highlighter>( - Settings::new(vec![], Highlight::default_style, theme, "rs"), + Settings::new(vec![], highlight_style, theme, "rs"), Highlight::to_format, ) .style(|theme, _| { |
