pub struct ElementStyle {
pub fill_color: Option<String>,
pub stroke_color: Option<String>,
pub stroke_width: Option<f64>,
pub text_color: Option<String>,
pub text_size: Option<f64>,
pub opacity: Option<f64>,
pub class_name: Option<String>,
pub attributes: HashMap<String, String>,
}Expand description
Style information for rendering elements
Fields§
§fill_color: Option<String>Optional override for the fill color.
stroke_color: Option<String>Optional override for the stroke color.
stroke_width: Option<f64>Optional override for the stroke width.
text_color: Option<String>Optional override for the text color.
text_size: Option<f64>Optional override for the text size.
opacity: Option<f64>Optional override for the element opacity (0.0 to 1.0).
class_name: Option<String>Optional CSS class name for the element.
attributes: HashMap<String, String>Custom attributes to be added to the SVG element.
Implementations§
Source§impl ElementStyle
impl ElementStyle
Sourcepub fn with_stroke(self, color: String, width: f64) -> Self
pub fn with_stroke(self, color: String, width: f64) -> Self
Sets the stroke color and width.
Sourcepub fn with_opacity(self, opacity: f64) -> Self
pub fn with_opacity(self, opacity: f64) -> Self
Sets the element opacity.
Sourcepub fn with_class(self, class_name: String) -> Self
pub fn with_class(self, class_name: String) -> Self
Sets the CSS class name.
Sourcepub fn with_attribute(self, key: String, value: String) -> Self
pub fn with_attribute(self, key: String, value: String) -> Self
Adds a custom attribute.
Trait Implementations§
Source§impl Default for ElementStyle
impl Default for ElementStyle
Source§impl<'de> Deserialize<'de> for ElementStyle
impl<'de> Deserialize<'de> for ElementStyle
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ElementStyle
impl RefUnwindSafe for ElementStyle
impl Send for ElementStyle
impl Sync for ElementStyle
impl Unpin for ElementStyle
impl UnsafeUnpin for ElementStyle
impl UnwindSafe for ElementStyle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more