Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flat icons are black and aren't rendered? #455

Open
brycesnyder opened this issue Oct 17, 2022 · 8 comments
Open

Flat icons are black and aren't rendered? #455

brycesnyder opened this issue Oct 17, 2022 · 8 comments

Comments

@brycesnyder
Copy link

brycesnyder commented Oct 17, 2022

When compiling icons, they look correct in our Figma and SVG files, but when we parse them they come out looking black.

Some instances do work, others don't; has anyone experienced this and know a potential workaround?

Namely, Asm-Ad where its completely black and should be a plus in the middle, and the top of the envelope on Asm-AddSafeEm etc.

Screen Shot 2022-10-17 at 4 28 44 PM

@Mirta91
Copy link

Mirta91 commented Feb 16, 2023

Same thing is happening to my icons. Anybody with more insight about this subject?

2023-02-16 14_28_42-localhost_6060_ui-kit

@Mirta91
Copy link

Mirta91 commented Feb 17, 2023

The solution is preparing properly svg icons in editing tool like Illustrator.

For example on the first image you can see that the Clipping path is hiding all the paths - so remove it.
image

Then select all the paths and unite them in pathfinder tool.
image

@Thibaut-Lalanne
Copy link

Thanks @Mirta91 for the tips, but it still doesn't work for me... All my icons are already "Flatten" on Figma, it's the equivalent of Illustrator's "Unite" action.

On the other hand, I have found something that is still mind-boggling and incomprehensible: In my case, it looks like it's linked to the color of my icons…

Mine are all in #03080f, and if I change this color by another one it works! But I'm obliged to keep #03080f so I'm trying to understand what link there might be between the icon colour and this problem.

@5310
Copy link

5310 commented Jul 20, 2023

After having manually fixed a small bunch of icons from Figma which were exhibiting this issue I am now convinced this bug happens with icons whose shapes touch the outermost pixels of their canvas. (At least icons that get exported from Figma. I never tried to make any changes with Inkscape etc.)

This included both icons that touched the boundaries fully (16px wide on 16×16 canvas) or ones that were exactly 1px short on each side, and even icons that were small enough to not touch the outer ring of pixels by themselves, but whose AABB still touched the boundary when rotated!

image
image

I have no idea why this happens, but this is definitely what was the case with me. I shrunk all of my culprits by a tiny amount (and flattened the rotated ones in Figma and making new AABBs not touch the boundary again), and immediately they started to render properly again.

I'd rather not have to do that though as it messes with the pixel alignment a lot. So still hoping for a fix!

@tharindulak
Copy link

tharindulak commented Sep 8, 2023

I am also facing the above issue using this library, Any update on the above issue?

@coolof
Copy link

coolof commented Nov 14, 2023

This is not a problem with either Figma or fantasticon directly. In most cases is has to do with svg fill rules. Figma saves svg with fill-rule="evenodd" while fonts only support nonzero. Just replacing this in all the svg files will not fix the issue however. There's a great Figma plugin called Fill Rule Editor that let you control this manually. I've found that it's easier to use the exported svg's to fix this. Basically:

  1. Export your icons from Figma as svg
  2. Import these svg's in Figma (preferably on a new page)
  3. Open Fill Rule Editor plugin
  4. Select a "broken" icon (from the font) in and make sure that all paths are nonzero (blue) and change the direction of "broken" paths so that the icon looks right. Change direction by clicking on a path, represented with arrows in the plugin.
  5. Export the fixed icons and use these with fantasticon.

fill-rule-fixed

@retyui
Copy link

retyui commented Mar 7, 2024

This is not a problem with either Figma or fantasticon directly. In most cases is has to do with svg fill rules. Figma saves svg with fill-rule="evenodd" while fonts only support nonzero. Just replacing this in all the svg files will not fix the issue however. There's a great Figma plugin called Fill Rule Editor that let you control this manually. I've found that it's easier to use the exported svg's to fix this. Basically:

  1. Export your icons from Figma as svg
  2. Import these svg's in Figma (preferably on a new page)
  3. Open Fill Rule Editor plugin
  4. Select a "broken" icon (from the font) in and make sure that all paths are nonzero (blue) and change the direction of "broken" paths so that the icon looks right. Change direction by clicking on a path, represented with arrows in the plugin.
  5. Export the fixed icons and use these with fantasticon.

fill-rule-fixed

@coolof Thank you so much; I appreciate it very lot.

It really works

@Bistard
Copy link

Bistard commented Apr 20, 2024

@coolof You saved my day. Appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants