Misrendered objects
I have noticed some misrendered objects while porting the symbolics script to use librsvg instead of Inkscape
if we took for example the icon set https://gitlab.gnome.org/Teams/Design/icon-development-kit/blob/master/src/icons.svg and we try to export the step-in icon from UI. The resulted icon look like this
I'm not sure what causes this for some icons, probably someone from the design team can tell more.
The broken rendered icon(even if it looks ok): it needs to be loaded as a symbolic icon to notice that.
Here's what I'm using to render those symbolics
pub fn render_symbolic(icon_path: &PathBuf, icon_size: i32, is_dark: bool) -> Option<Pixbuf> {
let gicon = gio::FileIcon::new(&gio::File::new_for_path(&icon_path));
let theme = gtk::IconTheme::get_default()?;
let mut flags = gtk::IconLookupFlags::FORCE_SVG;
flags.insert(gtk::IconLookupFlags::FORCE_SYMBOLIC);
flags.insert(gtk::IconLookupFlags::FORCE_SIZE);
let icon_info = theme.lookup_by_gicon(&gicon, icon_size, flags)?;
let mut fg_color = String::new();
let warning_color = String::from("#f57900");
let error_color = String::from("#ff8080");
let mut success_color = String::new();
if is_dark {
fg_color.push_str("#eeeeec");
success_color.push_str("#33d17a");
} else {
fg_color.push_str("#2e3436");
success_color.push_str("#229656");
}
if let Ok((pixbuf, _)) = icon_info.load_symbolic(
&gdk::RGBA::from_str(&fg_color).unwrap(), // We are sure that RGBA can parse those colors
Some(&gdk::RGBA::from_str(&success_color).unwrap()),
Some(&gdk::RGBA::from_str(&warning_color).unwrap()),
Some(&gdk::RGBA::from_str(&error_color).unwrap()),
) {
return Some(pixbuf);
}
None
}
Edited by Bilal Elmoussaoui