Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Color in the Unicode standard?

Tags:

unicode

Unicode 6.0 added several characters with descriptions that suggest those characters are supposed to be rendered in a specific color:

  • RED APPLE U+1F34E
  • GREEN APPLE U+1F34F

  • BLUE HEART U+1F499

  • GREEN HEART U+1F49A
  • YELLOW HEART U+1F49B
  • PURPLE HEART U+1F49C

  • GREEN BOOK U+1F4D7

  • BLUE BOOK U+1F4D8
  • ORANGE BOOK U+1F4D9

  • LARGE RED CIRCLE U+1F534

  • LARGE BLUE CIRCLE U+1F535

  • LARGE ORANGE DIAMOND U+1F536

  • LARGE BLUE DIAMOND U+1F537
  • SMALL ORANGE DIAMOND U+1F538
  • SMALL BLUE DIAMOND U+1F539

  • UP-POINTING RED TRIANGLE U+1F53A

  • DOWN-POINTING RED TRIANGLE U+1F53B
  • UP-POINTING SMALL RED TRIANGLE U+1F53C
  • DOWN-POINTING SMALL RED TRIANGLE U+1F53D

I had thought font symbols were always grayscale.

Did the unicode authors forsee that these might be rendered in different colors?
Within the official unicode.org PDFs (http://www.unicode.org/charts/PDF/U1F300.pdf), these are portrayed only as having different types of crosshatching.

Is there any current mechanism that would allow for specific characters to be rendered in a specific color, based only on its codepoint, and not any other rich-text formatting? (eg. a color property within TrueType or OpenType font files)

like image 848
Dee Newcum Avatar asked Mar 08 '12 22:03

Dee Newcum


People also ask

What is Unicode Standard font?

A Unicode font is a computer font that maps glyphs to code points defined in the Unicode Standard. The vast majority of modern computer fonts use Unicode mappings, even those fonts which only include glyphs for a single writing system, or even only support the basic Latin alphabet.

How do I change the Unicode symbol color?

The color is inherent to the character -- there's a LARGE BLUE CIRCLE as well (U+1F535 - 🔵), but no other colors are currently defined by the Unicode standard.

What is a Unicode example?

The code point is a unique number for a character or some symbol such as an accent mark or ligature. Unicode supports more than a million code points, which are written with a "U" followed by a plus sign and the number in hex; for example, the word "Hello" is written U+0048 U+0065 U+006C U+006C U+006F (see hex chart).


3 Answers

From the Unicode FAQ: Emoji and Dingbats, bolding mine:

Q: What about characters whose name specifies a color?

A: Some of the characters from the core emoji sets have names that include a color term, for example, BLUE HEART or ORANGE BOOK. These color terms in the names do not imply any requirement about how a character must be presented; they are intended only to help identify the corresponding character in the core emoji sets. Even names of symbols such as BLACK MEDIUM SQUARE or WHITE MEDIUM SQUARE are not meant to indicate that the corresponding character must be presented in black or white, respectively; rather, the use of black and white is generally just to contrast filled versus outline shapes, or a darker color fill versus a lighter color fill. [PE]

There was quite a bit of debate on the mailing lists at the time on whether these should be named with colors, or generic names that didn't reference color, and whether that was setting a bad precendent. The Emoji Symbols: Background Data includes "old names" such as APPLE-1 instead of RED APPLE and BOOK-3 instead of ORANGE BOOK.

The final names use this principle:

Symbols with an inherent color shall bear this color in their name unless the entity denoted by the name has identifies the color anyway (e.g., a BANANA is uniquely yellow and therefore does not need to be called YELLOW BANANA, while a RED APPLE must be named so as there are also green apples).

like image 97
Scott McIntyre Avatar answered Oct 14 '22 11:10

Scott McIntyre


Unicode 6.1 have a feature to change glyph for the same unicode code point, by specifying Variation Selector(U+FE0x).

For example, left-pointing triangle(@"\U000025C0", ◀) can be colored by adding "\U0000FE0F" ◀️* and non-colored by adding "\U0000FE0E" as suffix. (@"\U000025C0\U0000FE0E", ◀︎**).

*looks default on Mac OS X 10.8
**This is default on Linux.

like image 45
Tsuneo Yoshioka Avatar answered Oct 14 '22 13:10

Tsuneo Yoshioka


From https://docs.microsoft.com/en-us/typography/opentype/spec/otff#tables-related-to-color-fonts:

Tables Related to Color Fonts

  • COLR: Color table
  • CPAL: Color palette table
  • CBDT: Color bitmap data
  • CBLC: Color bitmap location data
  • sbix: Standard bitmap graphics
  • SVG : The SVG (Scalable Vector Graphics) table

In short,

  • CBDT/CBLC contain colored bitmaps (in PNG). They were proposed by Google.

  • sbix contains colored bitmaps (in JPG, PNG, or TIFF). It was proposed by Apple.

  • COLR defines one or more accompanying color glyphs (in vector format) for each glyph, and when they are overlapped they create the final colored glyph. CPAL defines several color themes (dark-on-white, white-on-dark, ...) since COLR is merely paletted images. COLR/CPAL were proposed by Microsoft.

  • SVG was proposed by Mozilla and Adobe. It may be used with CPAL.

FreeType (part of Android, iOS, and macOS) supports CBDT/CBLC and sbix since 2.5 and 2.5.1 (released in 2013), and COLR/CPAL since 2.10.0 (released in 2018). DirectWrite (part of Windows) supports COLR/CPSL since 8.1 (released in 2013) and all four above since 10 1607 (released in 2016).

Noto Color Emoji (default on Android) uses CBDT/CBLC. Segoe UI Emoji (default on Windows) uses COLR/CPAL. Apple Color Emoji (default on iOS and macOS) uses sbix.

See also https://en.wikipedia.org/wiki/OpenType#Color

like image 45
dolly17107 Avatar answered Oct 14 '22 13:10

dolly17107