Is it possible to use multicolor font icon in iOS?

Viewed 218

I have this 3 colored SVG included in my TTF font icon file. I am able to use mono color font icon, but with multicolor or even bi-color it is getting broken.

This is my code for to use font icon. It is working perfectly fine for single colored font icon.

Is setting font icon as Attributed String a solution. If yes then how (I mean range) ?

public class func stringForIcon(_ icon: NSInteger) -> String {
        let iconString = String(Character(UnicodeScalar(icon)!))
        return iconString
    }

enter image description here

1 Answers

This will be difficult, if not impossible, to achieve with a font. Fonts are monochrome by defaults, and the available extensions for multicolor fonts are not supported by many browsers.

But you can try this with SVG, which is supported by all modern browsers. I created the style for your icon with Iconfu using Google's Material icons. Just follow this link and enter "star" in the search bar you can see several star icons in your style. Simply select the icon that fits best and download it as an SVG file.

enter image description here

Related