summaryrefslogblamecommitdiffstats
path: root/style/src/svg.rs
blob: 5053f9f8ccf5c00bafc5cd992dd244438a10bc3b (plain) (tree)
1
2
3
4
5
6
7
8
9
10



                                   
                             

                                      
                                       

                                            


                                        




                                                  
                        

                                               
                                                            


                                                             
 
//! Change the appearance of a svg.

use iced_core::Color;

/// The appearance of an SVG.
#[derive(Debug, Default, Clone, Copy)]
pub struct Appearance {
    /// The [`Color`] filter of an SVG.
    ///
    /// Useful for coloring a symbolic icon.
    ///
    /// `None` keeps the original color.
    pub color: Option<Color>,
}

/// The stylesheet of a svg.
pub trait StyleSheet {
    /// The supported style of the [`StyleSheet`].
    type Style: Default;

    /// Produces the [`Appearance`] of the svg.
    fn appearance(&self, style: &Self::Style) -> Appearance;

    /// Produces the hovered [`Appearance`] of a svg content.
    fn hovered(&self, style: &Self::Style) -> Appearance;
}