feat: SVG styling with icon fill color
This commit is contained in:
parent
0249640213
commit
75ae0de9bd
7 changed files with 137 additions and 22 deletions
|
|
@ -6,11 +6,14 @@ use std::hash::{Hash, Hasher as _};
|
|||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub use iced_style::svg::{Appearance, StyleSheet};
|
||||
|
||||
/// A handle of Svg data.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Handle {
|
||||
id: u64,
|
||||
data: Arc<Data>,
|
||||
appearance: Appearance,
|
||||
}
|
||||
|
||||
impl Handle {
|
||||
|
|
@ -36,6 +39,7 @@ impl Handle {
|
|||
Handle {
|
||||
id: hasher.finish(),
|
||||
data: Arc::new(data),
|
||||
appearance: Appearance::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -48,6 +52,16 @@ impl Handle {
|
|||
pub fn data(&self) -> &Data {
|
||||
&self.data
|
||||
}
|
||||
|
||||
/// Returns the styling [`Appearance`] for the SVG.
|
||||
pub fn appearance(&self) -> Appearance {
|
||||
self.appearance
|
||||
}
|
||||
|
||||
/// Set the [`Appearance`] for the SVG.
|
||||
pub fn set_appearance(&mut self, appearance: Appearance) {
|
||||
self.appearance = appearance;
|
||||
}
|
||||
}
|
||||
|
||||
impl Hash for Handle {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue