A sharp vs. a slightly blurry national park emoji and a bar chart highlighting the size difference between COLRv1 and a bitmap font: about 9MB vs. 1.85MB.

COLRv1 Color Gradient Vector Fonts in Chrome 98

Published on

Compact, compression-friendly, color vector fonts with all your favorite gradient flavors.

In Chrome 98, the Chrome and Fonts teams have added support for COLRv1, an evolution of the COLRv0 font format intended to make color fonts widespread by adding gradients, compositing and blending, and improved internal shape reuse for crisp and compact font files that compress well.

Examples in this blog post require a browser that supports COLRv1 fonts. Try viewing this post in Chrome 98 or above.

Color now

On the web, text is generally drawn in a color specified in CSS. The font does not define any particular color, it just indicates where pixels should be placed. That's usually a good thing. CSS lets the author flexibly choose a color. However, sometimes a glyph contains multiple colors that together have meaning. For example, this flag Transgender flag consisting of pale blue and pale pink stripes. with light blue, pink, and white stripes would not convey the same meaning if it was simply drawn in the current text color.

Today, for most users, emojis are the only color fonts they see. Emojis typically appear on the web via the system emoji font, or by inserting images (which has its own complications, Panda emoji with sad facial expression.). Large file sizes especially for bitmap-based color fonts have made it difficult to use web fonts for emoji. By supporting COLRv1, we hope to see a proliferation of creative color font use on the web and beyond.

Show me your colors

We've created a couple of examples for you to play with:

The example assets from Google Fonts used in the example are live in the Google Fonts web API. They are not listed in the directory at fonts.google.com as they will only work on Chrome 98 or later and showcase experimental work.

You can now make your own COLRv1 fonts using free and open-source tools. Check out the nanoemoji font compiler which allows you to build COLRv1 fonts from SVG source images, then try them in Chrome 98 or later. Try making your own spin on Bungee Spice by changing the gradient colors using these instructions.

For example, you might modify the Bungee Spice font to have a blue and red gradient, like this:

The word dune in the Bungee Spice color font, toned in blue and red gradients.

Tweet your results to @googlefonts 🙂 Why not try a radial or sweep gradient?

New with COLRv1

The font format supports multiple ways to support color, all with different tradeoffs – but none have been successful on the web so far. (To learn more about the tradeoffs, take a look at Dominik's BlinkOn 15 conference talk.) Chrome 98 brings support for COLRv1, an evolution of COLRv0. We hope that COLRv1's combination of graphic capabilities and compact files will make it a good choice for many color font use cases. COLRv1 adds gradients, compositing, and blending, and improves internal shape reuse to make even more compact files.

COLRv1 has expressive capability roughly equivalent to SVG Native plus blending and compositing added on top. There are four types of color fills: solid colors, linear gradients, radial gradients, and sweep/conic gradients. COLRv1 lets you reposition and transform glyph elements using a full set of translate, rotate, sheer, and scale transformations. Plus, it features support for font variations and reuses existing shape definition formats in the font.

Blue     and purple crystal ball emoji with reused stars on a brown base.
Shape reuse in the crystal ball emoji

Think about the crystal ball emoji as an example: The star-shaped highlights are the same shape but different sizes, which means just one shape can be repositioned and reused without duplication inside the file. The format allows you to reuse a full glyph within a new glyph, without having to redundantly encode the same shapes for each glyph. Imagine a decorative color font with floral decorations, where the same flower shapes are placed on different letters by just referencing existing color glyphs. For the web font use case, COLRv1 compresses well under woff2. For example, a test build of Twemoji using COLRv1 takes about 1.2 MB inflated, but is about 0.6MB in woff2 form. A build of the full Noto Emoji Glyph set is reduced from 9MB for the bitmap version to 1.85MB in COLRv1+woff2 form.

Bar chart comparing Noto Emoji as Bitmap font and COLRv1 font, about 9MB vs. 1.85MB
Noto Emoji font size CBDT/CBLC vs. COLRv1 after WOFF2 compression.

Color font use cases

Catchy headlines

A fresh color font makes visual highlights, headlines, and banners really pop out.

Plakato Color Happy 2022 featuring energetic sweep gradients, made by the innovative type foundry Underware (Twitter: @underware, Instagram: @underwarefoundry). Read more about Underware’s first COLRv1 release in their blog post.

No more image replacement: emoji fonts

If you support user generated content, your users probably use emojis. Today it's very common to scan text and replace any emoji encountered with images to ensure consistent cross-platform rendering and the ability to support newer emojis than the OS supports. Those images then have to be switched back to text during clipboard operations. Here's a real example:

A code snippet showing inline images as img tags and metadata as part of a chat history
Image replacement in Google Chat

If you have an emoji font you just render the text in the font, like this:

<style>
@import url(https://fonts.googleapis.com/css2?family=Noto+Color+Emoji);

.emoji {
font-family: "Noto Color Emoji", sans-serif;
}
</style>
<span class="emoji">🙂</span>

Similarly, in an emoji reaction component, COLRv1 offers the opportunity to use a compact font file instead of a catalog of image assets.

Emoji picker UI as used on GitHub
Emoji Reaction Picker on GitHub

Imagine how many images you'd have to fetch for a complete emoji picker!

Color in icon fonts

Using color in icon fonts adds clarity and makes glyphs easier to understand.

Three green icons in black outline
Material two-tone icons from https://fonts.google.com/icons

Artistic expression

Space-efficient color fonts enable new forms of artistic expression in text on the web. This example of a Kufi-style Arabic font uses color gradients as an artistic interpretation of what the ink flow of traditional calligraphy could look like when applied to the Kufi style of Arabic writing, which originates from not being written with nib and ink but carved in stone.

Arabic letters with gradients from black to red.
Reem Kufi Ink, an Arabic font by Khaled Hosny

Feature detection

At the moment, figuring out whether a browser engine supports a specific color font format is possible by means of user-agent sniffing or by searching in a library like ChromaCheck by @PixelAmbacht to test rendering of color glyphs on Canvas. Both solutions are not optimal. Feature testing should detect only a specific feature itself and avoid user agent sniffing. The ChromaCheck library should not need to perform resource-intensive 2D canvas operations for determining support.

The Chrome team wants to improve that and has started a series of discussions [1, 2] in the CSS working group to provide information on browser font technology support in JavaScript and declaratively in CSS. The team plans to release efficient feature detection for color font and other font technologies in a future version of Chrome.

If you would like to use color fonts in your project right now when COLRv1 support is limited to Chrome, there are two ways you can do that: Ask your font vendor for a COLRv1 font that contains monochrome glyphs too. User agents that don’t support COLRv1 will fall back to rendering monochrome glyphs. Alternatively, you can use the ChromaCheck library or user agent sniffing to determine whether COLRv1 support is available. Then you deliver CSS that loads COLRv1 fonts in supporting user agents and use an alternative font format such as COLRv0, a bitmap font format or OpenType SVG in other browsers.

CSS font-palette support

It would be tremendously useful if using a different set of colors would not require a new font. Thankfully, a mechanism exists: the font-palette CSS property. The Chrome team is working on adding support for font-palette in Chrome.

COLRv1 fonts & you

If COLRv1 fonts piques your interest, ask your font vendor about a COLRv1 color font to use in your project, try the examples and demos above, or why not dive right in and experiment with making your own?

If you have feedback on COLRv1 in Chrome, post to the blink-dev mailing list, or file an issue in our issue tracker. If you have feedback on the COLRv1 font format itself, file an issue at the COLRv1 specification GitHub repository.

With Chrome 98, we’re excited about how COLRv1 brings a whole new level of typographic creativity to the web.

Learn more

If you're interested in more details, we have a couple more resources for you:

To learn how COLRv1 works and how it's implemented in Chrome, check out Dominik's BlinkOn 15 conference talk.

Acknowledgements

Many thanks to Behdad Esfahbod, Cosimo Lupo, Peter Constable, Ben Wagner, Werner Lemberg, Dave Crossland, Vladimir Levantovsky, Jonathan Kew, Laurence Penney, Chris Lilley, David Jonathan Ross, Underware, Just van Rossum, Roel Nieskens, and others for their contributions to COLRv1.

Updated on Improve article

We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.