# iced_custom_highlighter [![builds.sr.ht status](https://builds.sr.ht/~pml68/iced_custom_highlighter.svg)](https://builds.sr.ht/~pml68/iced_custom_highlighter) A custom syntax highlighter for iced. It uses the colors from your app's Theme, based on a styling method (like `default_style`) [`two-face`](https://github.com/CosmicHorrorDev/two-face) is used for providing extra syntaxes. [More info](https://github.com/CosmicHorrorDev/two-face?tab=readme-ov-file#syntaxes) # Example ```rust use iced::widget::{column, pick_list, text_editor}; use iced::{Element, Theme}; use iced_custom_highlighter::{Highlight, Highlighter, Settings}; #[derive(Default)] struct State { content: text_editor::Content, theme: Option, } #[derive(Debug, Clone)] enum Message { Edit(text_editor::Action), ChangeTheme(Theme), } fn view(state: &State) -> Element<'_, Message> { column![ text_editor(&state.content) .placeholder("Type something here...") .highlight_with::( Settings::new(vec![], Highlight::default_style, "rs"), Highlight::to_format, ) .on_action(Message::Edit), pick_list( state.theme.clone(), Theme::ALL, Theme::to_string ) .on_select(Message::ChangeTheme), ].into() } fn update(state: &mut State, message: Message) { match message { Message::Edit(action) => { state.content.perform(action); } Message::ChangeTheme(theme) => { state.theme = Some(theme); } } } ```