www 101

All you need to know about the internet

Have a Question?

If you have any question you can ask below or enter what you are looking for!

How to Use Color Fonts on the Web

Every web designer knows how to set a font’s color, right? It’s one of the first things we do when we begin learning CSS. We choose a color, then we use styles to set it, like color: blue; or color: purple;, so all the glyphs in our chosen font turn that color, and only that color.

But what if you could define more than one color per glyph? What if you could make your letters blue and purple, or have gradients running between blue and purple, or even have half a dozen colors or more applied to a single font family?

Well, with the emergence of Open Type color fonts, you can do just that.

Check out this image of four different color fonts:

This might look like fixed images put together in Illustrator, but you’re actually looking at live, editable, search engine readable text in a browser.

Rather than having their color controlled via CSS, these fonts have internal information that allows them to have multiple colors per glyph, making for a pretty striking display.

Using Color Fonts

Color fonts are still quite new so there hasn’t been a massive number of them released just yet, and among those that are available there’s a mix of free and paid fonts. To make sure you can play around with color fonts yourself, I picked out four free fonts for our demo. You can grab copies of these fonts at the following locations:

  • Gilbert on typewithpride.com
  • Abalone on colorfontweek.fontself.com
  • Playbox on colorfontweek.fontself.com
  • Bixa on bixacolor.com

The code used to add them to the page is nothing new, it’s just the plain old @font-face you know and love:

Browsers and Support

At this moment in time, if you want to try out color fonts in the browser you’ll need to use either Firefox or Edge, the only two browser with full support. Safari limits support to SBIX format only. Chrome has support only on Android, and then just for CBDT format. Opera has no support at all.

CSS Modification

At the moment we can’t use CSS to change the colors that are used within a color font. However, it is possible for a font designer to ship a font with a number of preset variations included. Those variations can then be modified by using the property font-feature-settings.

We can see this functionality in action via Robin Rendle’s demo of the Trajan Color font from TypeKit.

Colors Are Fixed, Even on Links

As the colors of a color font are fixed inside the font itself, the color property you usually apply to your text will have absolutely no effect, including on links, whatever their state.

It’s also worth being aware that while no color change will occur with links, they can still have their default underline text decoration applied, and that the underline will receive any color you specify through your CSS. If you decide to combine color fonts and links, it might be worth using such an underline to help users distinguish links from the rest of the text.

Here’s some example code:

This will give us the red underline seen here on the last word:

Wrapping Up

Between color fonts and variable fonts, the newest developments for Open Type look to be making fonts in the browser much more fun and interesting. The future of web design typography looks bright!

Related Links