[flutter_svg] Stroke opacity not applied #158735
Labels
p: flutter_svg
The Flutter SVG drawing packages
P3
Issues that are less important to the Flutter project
package
flutter/packages repository. See also p: labels.
Imported from dnfield/flutter_svg#891
Original report by @Maatteogekko on Mar 17, 2023
Take this svg as an example
I am using the color mapper API to remap colors like this:
If I use a color with opacity != 1, let's say
iconColor = Color(0x802260DD)
as the base color, only the fill gets the opacity applied; the stroke remains fully opaque.Maybe related to dnfield/flutter_svg#617
Comment by @dnfield on Mar 17, 2023
Yeah, there's a bug here for sure. Taking a look.
Comment by @dnfield on Mar 17, 2023
Ok. So I can definitely fix the whole "stroke opacity is getting ignored" part, but be aware that strokes and fills get composited individually and the opacity will be multiplicative - so your case will be something like this SVG:
Which will not look like a single uniform color.
Comment by @Maatteogekko on Mar 18, 2023
You're right. To get a uniform color I tried with this:
But it still doesn't render correctly. I guess it's the same problem?
Comment by @dnfield on Mar 19, 2023
If you want it uniform just remove the stroke attribute(s)
Comment by @devmaslove on Oct 18, 2023
I have the same problem. In svg file: stroke="currentColor"
If I set currentColor with opacity -
opacity is ignored
The text was updated successfully, but these errors were encountered: