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:
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.
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.
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.