diff options
| author | Polesznyák Márk <contact@pml68.dev> | 2025-10-20 14:23:22 +0200 |
|---|---|---|
| committer | Polesznyák Márk <contact@pml68.dev> | 2025-10-20 14:24:33 +0200 |
| commit | d3437d1b64cc632ab7358264825db683d15d1c69 (patch) | |
| tree | 51b38588bf9b26f3664d89a575cf7e74696a1405 | |
| parent | chore: update mailing list address (diff) | |
| download | iced_material-d3437d1b64cc632ab7358264825db683d15d1c69.tar.gz | |
feat: add support for `pml68/iced_selection`
| -rw-r--r-- | Cargo.toml | 7 | ||||
| -rw-r--r-- | README.md | 3 | ||||
| -rw-r--r-- | src/lib.rs | 2 | ||||
| -rw-r--r-- | src/selection.rs | 22 |
4 files changed, 33 insertions, 1 deletions
@@ -22,6 +22,8 @@ animate = ["dep:iced_anim"] crisp = ["iced_widget/crisp"] # Provides support for `iced_dialog`. dialog = ["dep:iced_dialog"] +# Provides support for `iced_selection`. +selection = ["dep:iced_selection"] # Provides support for the markdown widget. markdown = ["iced_widget/markdown"] # Provides support for the SVG widget. @@ -39,6 +41,11 @@ git = "https://git.sr.ht/~pml68/iced_dialog" branch = "master" optional = true +[dependencies.iced_selection] +git = "https://git.sr.ht/~pml68/iced_selection" +branch = "master" +optional = true + [dependencies.iced_anim] git = "https://github.com/bradysimon/iced_anim" branch = "iced/master" @@ -19,7 +19,8 @@ - `serde`: Provides [`serde`](https://docs.rs/serde) support. - `animate`: Provides support for animating with [`iced_anim`](https://github.com/bradysimon/iced_anim/tree/iced/master). - `crisp`: Enables pixel snapping for crisp edges by default (can cause jitter!). -- `dialog`: Provides support for [`iced_dialog`](https://github.com/pml68/iced_dialog). +- `dialog`: Provides support for [`iced_dialog`](https://git.sr.ht/~pml68/iced_dialog). +- `selection`: Provides support for [`iced_selection`](https://git.sr.ht/~pml68/iced_selection). - `markdown`: Provides support for the markdown widget. - `svg`: Provides support for the SVG widget. - `qr_code`: Provides support for the QR code widget. @@ -23,6 +23,8 @@ pub mod qr_code; pub mod radio; pub mod rule; pub mod scrollable; +#[cfg(feature = "selection")] +pub mod selection; pub mod slider; #[cfg(feature = "svg")] pub mod svg; diff --git a/src/selection.rs b/src/selection.rs new file mode 100644 index 0000000..cbf8bd4 --- /dev/null +++ b/src/selection.rs @@ -0,0 +1,22 @@ +use iced_selection::text::{Catalog, Style, StyleFn}; + +use super::Theme; + +impl Catalog for Theme { + type Class<'a> = StyleFn<'a, Self>; + + fn default<'a>() -> Self::Class<'a> { + Box::new(default) + } + + fn style(&self, class: &Self::Class<'_>) -> Style { + class(self) + } +} + +pub fn default(theme: &Theme) -> Style { + Style { + color: None, + selection: theme.colors().primary.primary_container, + } +} |
