summaryrefslogtreecommitdiffstats
path: root/style
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-17 15:29:14 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-17 15:29:14 +0200
commit76dc82e8e8b5201ec10f8d00d851c1decf998583 (patch)
tree18b48610e48ee90821a2c7678e9ce2f236868f01 /style
parent723111bb0df486bffaedcaed0722b1793d65bfe3 (diff)
downloadiced-76dc82e8e8b5201ec10f8d00d851c1decf998583.tar.gz
iced-76dc82e8e8b5201ec10f8d00d851c1decf998583.tar.bz2
iced-76dc82e8e8b5201ec10f8d00d851c1decf998583.zip
Draft `Highlighter` API
Diffstat (limited to 'style')
-rw-r--r--style/src/lib.rs2
-rw-r--r--style/src/text_editor.rs16
2 files changed, 16 insertions, 2 deletions
diff --git a/style/src/lib.rs b/style/src/lib.rs
index 7a97ac77..c9879f24 100644
--- a/style/src/lib.rs
+++ b/style/src/lib.rs
@@ -15,7 +15,7 @@
clippy::needless_borrow,
clippy::new_without_default,
clippy::useless_conversion,
- missing_docs,
+ // missing_docs,
unused_results,
rustdoc::broken_intra_doc_links
)]
diff --git a/style/src/text_editor.rs b/style/src/text_editor.rs
index 45c9bad8..f1c31287 100644
--- a/style/src/text_editor.rs
+++ b/style/src/text_editor.rs
@@ -1,5 +1,6 @@
//! Change the appearance of a text editor.
-use iced_core::{Background, BorderRadius, Color};
+use crate::core::text::highlighter;
+use crate::core::{self, Background, BorderRadius, Color};
/// The appearance of a text input.
#[derive(Debug, Clone, Copy)]
@@ -45,3 +46,16 @@ pub trait StyleSheet {
/// Produces the style of a disabled text input.
fn disabled(&self, style: &Self::Style) -> Appearance;
}
+
+pub trait Highlight<Font = core::Font, Theme = crate::Theme> {
+ fn format(&self, theme: &Theme) -> highlighter::Format<Font>;
+}
+
+impl<Font, Theme> Highlight<Font, Theme> for () {
+ fn format(&self, _theme: &Theme) -> highlighter::Format<Font> {
+ highlighter::Format {
+ color: None,
+ font: None,
+ }
+ }
+}