image icon
This commit is contained in:
parent
6f17328eb1
commit
3850def414
2 changed files with 12 additions and 6 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use iced::{widget::svg, Length};
|
||||
use iced::{widget::{svg, Image}, Length};
|
||||
|
||||
pub fn icon<Renderer>(name: &str, size: u16) -> svg::Svg<Renderer>
|
||||
where
|
||||
|
|
@ -22,3 +22,12 @@ where
|
|||
.width(Length::Units(size))
|
||||
.height(Length::Units(size))
|
||||
}
|
||||
|
||||
pub fn image_icon(name: &str, size: u16) -> Option<Image>
|
||||
{
|
||||
freedesktop_icons::lookup(name)
|
||||
.with_size(size)
|
||||
.with_cache()
|
||||
.find().map(|path| Image::new(path).width(Length::Units(size))
|
||||
.height(Length::Units(size)))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue