Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49230

How to add custom icons to ion-icons in ionic-v4

$
0
0

@michaelkariv wrote:

Alongside excellent ion-icons I would like to use my own. I have them both as SVG and also as an icon font (done using icomoon.io online font builder).

Important to me is to make my icons adhere to the theme (using color defaults) but also be stylable with specific colors (using color attribute)

in ionic-v3 it was done using css+font. In ionic-v4, I am told (on ionic slack forum, by mike) icon font is no longer an option. Suggestion is to use src attribute just so:

<ion-icon src="/path/to/external/file.svg"></ion-icon>

The problem with it, besides being less elegant then just using the ‘name’ attribute is styling - it does not react to color attribute. I tried it.

Options that I considered are

  1. forking ion-icon repo. I hate it because I want downstream fixes
  2. forking font awesome angular control. Not good because I want the same attributes as ion-icon
  3. as above, except wrapping into something e.g. div that uses ionic styling. doable but a gut feeling there must be a better solution

Ideally, IMHO, ion-icon should be split into a web component for any set of gliphs adhering to certain principles (e.g. naming, that will make switching between ios and mg easy), AND a separate extendable set of icon glyphs.

Mike suggested I do a pull request. Before I do so, I would like to hear your opinions.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49230

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>