Use text color to paint SVGs

This commit is contained in:
Antonio Scandurra
2023-10-18 09:39:20 +02:00
parent e031718747
commit 597a9f9548
5 changed files with 22 additions and 20 deletions
+5 -6
View File
@@ -84,14 +84,13 @@ where
Self: Sized,
{
self.base.paint(bounds, view, element_state, cx);
let fill_color = self
let color = self
.base
.compute_style(bounds, element_state, cx)
.fill
.as_ref()
.and_then(|fill| fill.color());
if let Some((path, fill_color)) = self.path.as_ref().zip(fill_color) {
cx.paint_svg(bounds, path.clone(), fill_color).log_err();
.text
.color;
if let Some((path, color)) = self.path.as_ref().zip(color) {
cx.paint_svg(bounds, path.clone(), color).log_err();
}
}
}