create multicolor icons. Icomoon

后端 未结 4 565
感情败类
感情败类 2020-12-17 03:43

It\'s been so hard to find any clear information about how to create icons with two colors (facebook -white and blue-, google- white and red.....). The customer wants to be

4条回答
  •  长情又很酷
    2020-12-17 04:29

    Creating multicolored icon fonts with icomoon is fairly easy but it combines them from multiple glyphs off course and seems to have no knowledge of a "default" color (the color which can be changed from the parent class) - so we need do define it as inherit in the CSS :

    1) Create your SVGs with your favorite vector app like Inkscape or Adobe Illustrator.

    Important : Icomoon (and anything else) will use one glyph for each colored path in the SVG, so make sure to join the pathes with the same color and don't use too many colors …

    Illustrator makes it easy to join compound pathes : https://www.youtube.com/watch?v=jbc3q9bfOH8 and to join objects: https://graphicdesign.stackexchange.com/questions/999/how-do-i-combine-two-objects-into-one-in-illustrator …

    2) Make your icomoon font.

    3) Determine your "default" color in the CSS - lets say it is rgb(62, 55, 60);:

    In [class^="icon-"], [class*=" icon-"] { add

    /* default color */
    color: rgb(62, 55, 60);
    

    and remove every other line reading

    color: rgb(62, 55, 60);
    

    or to be explicit change it to

    color: inherit;
    

    That's it.

    When I only use two colors (e.g. the darkgrey and orange) properly joined I would never get more than two children in the icon and I could change the darkgrey from the root node ...

    Here is a working codepen with a 2-color font used with only one element where you can change the color …

提交回复
热议问题