bgcl: Apple Color Emoji Background Color table
The bgcl table is an Apple private table used in Apple Color Emoji fonts.
It stores a JSON blob describing background color palettes used when rendering
emoji wallpapers on iOS 16 and later.
The JSON payload contains:
colors: a list of palette entries, each an[R, G, B, A]array where R/G/B are 0–255 and A is 0–1.emojicolors: per-emoji palette assignments referencing entries incolors.
Support for the bgcl (Apple Color Emoji background) table.
This table stores a JSON blob. We decode it to a Python object on decompile and emit human readable JSON in the TTX via a <json> element. On compile we re-encode the JSON to UTF-8 bytes which is what Apple code reads via CTFontCopyTable then JSONDecoder.
On iOS 16 and later the bgcl payload is used as the wallpaper background when the user selects an emoji wallpaper.
Fields:
colors: list of palette entries. Each entry is an array of fourintegers
[R, G, B, A]. R/G/B are 0-255. A is 0-1.
emojicolors: list of per-emoji palettes. Each item is an array ofthree sublists: primary/dominant, accent, contextual (names inferred). Each sublist contains integer indexes referencing entries in
colors; the runtime uses these to assemble layered background tints for an emoji.
indexmap: mapping (glyph identifier → palette index). The mapmaps a glyph identity to an integer index selecting an entry in
emojicolors. The font/UI uses this to pick the correct palette for a glyph when rendering wallpaper backgrounds.
version: integer table version used for parsing/compatibility.
Runtime usage summary:
- The system fetches the table bytes with
CTFontCopyTable('bgcl'), decodes the bytes as UTF‑8 JSON and runs the JSON through the app’s decoder into an internal
BgclTablestructure. The app looks up a glyph’s entry inindexmap, retrieves the correspondingemojicolorspalette, then converts the referencedcolorsentries into color objects (normalizing channels/alpha as needed). This resulting color(s) drive the wallpaper background appearance for emoji wallpapers on supported iOS versions.
- The system fetches the table bytes with
This implementation preserves the JSON payload and exposes convenience
attributes colors, emojicolors, indexmap and version
when available.
- class fontTools.ttLib.tables._b_g_c_l.table__b_g_c_l(tag: str | bytes | None = None)[source]
Bases:
DefaultTablebgcl table: stores a JSON blob describing background palettes.
- The JSON structure typically contains the top-level keys:
colors: [[R,G,B,A], …]
emojicolors: [[[dominant…],[accent…],[contextual…]], …]
indexmap: {“glyphIndex”: emojicolors_index, …}
version: int
- decompile(data: bytes, ttFont: TTFont) None[source]
Store raw bytes and attempt to parse JSON.
The JSON commonly includes palette/lookup data used at runtime to construct wallpaper/background colors for emoji wallpapers on recent iOS releases.
- compile(ttFont: TTFont) bytes[source]
Encode the JSON object to UTF-8 bytes for font binary storage.