Icon color not changing (after applying any change to the original components)?

Here’s a 2-minute video explaining the issue: Dropbox Capture

Basically, icons stop updating their color when I swap variants after I make any change to the original component in its library.

I’ve seen tons of topics discussing icons not changing color, but most (if not all) of them were solved by simply making sure the component layer names were consistent. I’m already using consistent naming and the issue is still there.

1 Like

One important detail: the issue does not happen on local components.

I’ve just updated the video to make it even more clear: Dropbox Capture

1 Like

Hey @Bruno_Barros!
I’ve replicated this with some other tests and figured it out.

The reason for this behavior is the “Icon” layer inside the Button component because you’ve changed the name of the icon component instance.

There are two simple ways to solve this issue:

  1. Do not rename the Icon component instance and keep its original name (important).
  2. Nest the icon instance (inside the button) in a new Auto Layout Frame – you can rename this to “Icon” for example.

If you do one or both of these you’ll see that the problem doesn’t occur anymore.
Just update your Button component (each variant!) like this and it should work properly.

2 Likes

That worked, @dennsi

Thank you so much :muscle:t3:

Weirdly, there are tons of topics in this forum saying that components that use the instance swap property need to keep their layer names consistent instead of using the actual icon component name.

2 Likes

Hi guys :slight_smile: Did I miss something? by creating an auto-layout frame around the icon?

1 Like

Can you share more details on the original components structure or provide a test file to look into?

1 Like

Sure:) This is the file which contains the button in context: https://www.figma.com/file/ZSYzHWUA26C4WQfw4xdlnV/Teszt-Fájl-1?node-id=1001-15362&t=Bvt0ffOuMFdg3C6d-4

Well I’m guessing the reason is how the Icon components are structured – or to be more clear how they are not structured… The iconset of the referenced WF Design System is probably the problem which causes unwanted color changes.
I can’t really explain why but Figma has many problems with nested icon components changing their colors in different states when the icons themselves have a different layer structure. All icons need to have the exact similar layer structure and layer naming.

Here are two icons as an example I’ve randomly picked from the icon set:
icon-1

icon-2

See how their layer count is different?

Goal should be to have every icon structured the same like this for example:
icon-new
You can do this by merging vector layers with boolean operations (union etc.) or use Flatten (CMD + E / Object>Flatten Selection), or even both. I’ve experienced problems with strokes in icons too, so you should also convert those to paths (Shift + CMD + O / Object>Outline Stroke).

I know that means much manual labor and time you need to invest to get the whole set ready. And maybe it doesn’t even work for every icon especially when multiple colors are involved.

But I suggest you get just a few new icons components ready and test your component and see if it behaves as expected.

4 Likes

Thank you so much for your answer! It was extremely helpful! Fortunately, this is a really small project (a small MVP), hence at the moment I need only 2 icons which needs to be switched sometimes. I just wanted to know what could be the problem, so I can resolve on bigger projects later.

Thanks a lot again! :blush:

1 Like

You’re welcome, glad I could help!

@dennsi I’ve run into yet another weird icon color issue: Desperate designer tries to survive yet another issue with components not updating icon colors

:pensive:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.