Docs / Themes and bubbles / Shaped bubbles

Shaped bubbles

A bubble style can be a plain bubble with a character sitting on its corners, or it can follow any outline you draw, such as a snake or a speech balloon with a bite out of it. For a drawn outline, Isolink lays the words, photos and cards of each message inside the shape line by line, and checks the result before showing it. If something can't fit, the bubble falls back to a simpler shape, so nothing gets cut off.

Themes and bubble styles Full spec (Markdown) Theme pack checker

What shaped bubbles are

Everyone

Most bubbles are rounded rectangles. The 15 Isolink characters, from Axolotl to Starry Jelly, are framed bubbles, free in Theme Studio's Browse tab from the Isolink store: an ordinary rounded body with a character drawn on its corners and edges, and a repeating background to match. Your words sit in the body as usual.

Two messages in the Axolotl bubbles: pink bubbles with a small axolotl on the corners
Axolotl
Two messages in the Red Panda bubbles: cream bubbles with a red panda peeking over the top corner
Red Panda
Two messages in the Penguin Puddle bubbles: pale blue bubbles with a penguin on the top corner
Penguin Puddle

A shaped bubble goes further and follows a drawn outline, such as a character's body, and the message fills that shape. The earlier built-in characters (Snake, Capybara, Cat, Bee, Train and Hotdog dog) were shaped bubbles. They're no longer offered in Theme Studio, but chats that already wear one keep it, and the examples on this page still use them.

You can start your own bubble from a copy of any of them in Theme Studio, or design a new one. The rest of this page explains how a message fits its bubble, first for everyone and designers, then for developers writing the JSON.

How a message is laid out

Everyone

Isolink doesn't put a shaped bubble's content in one rectangle. It places it piece by piece through the shape:

  1. Blocks first. The sender's name, the message being replied to, a photo or video, then any card, each as a rectangle in the widest free part of the shape. A photo or video is never narrower than 120 dp and cards and replies never narrower than 160 dp, and each keeps its own proportions.
  2. Then the words, line by line. Each line sits in the widest span that is free across its whole height. Lines beside a head or a paw are shorter, and lines with nothing beside them take the full width. Bold, links and other formatting flow with the lines.
  3. Then the time. It goes after the last line's words when there is room, or on its own line below. Delivery ticks sit outside the bubble.

The bubble's height is worked out, not guessed. It grows until everything fits, then narrows to the smallest height that still fits. Short messages stay short, and long ones grow up through the character's body, keeping the head and feet the same size.

Two cat bubbles: a short one saying On my way, and a long one whose text fills a tall body above the cat's head and tail
A short and a long message
A cat bubble holding a blue photo placeholder above the caption The view from the top
A photo is a block, kept in its own proportions

A very long message (over 800 characters or 12 or more lines), which you can unfold, and a message holding a code block stay as one rectangle inside the shape.

The same long message in a snake bubble at two widths: a tall narrow column and a wider, shorter body
The same message on a narrow and a wide screen. The shape stretches only in its plain middle, never through the head or tail.

Nothing is cut off

Everyone

Before a shaped bubble is shown, every line, block and the time is checked against the final shape, and against each other so that nothing overlaps. If the check fails, Isolink steps back:

  1. First it puts the content in the largest rectangle that fits inside the shape, and checks that.
  2. If that fails too, the bubble is drawn as an ordinary rounded bubble in the style's colour with a thin outline, and the decorations are put away.

Either way every word, link, photo and button is shown in full and can be tapped. Content is never clipped to make it fit.

A plain rounded mint-green bubble with a thin green outline holding the whole long message
The fallback: a plain bubble with everything in it
This bubble's style asked for the whole body to be kept clear, so no line could fit. Isolink drew it as a plain bubble instead. You see this only when a style can't hold a message; Isolink's characters always fit, at every width and text size they are tested with.

Reactions

Everyone

On a shaped bubble, reactions can hang from a point the designer chose, such as under the inner corner, clear of the words. Wherever the reactions reach past the bubble, Isolink keeps that much room around it, so they are never cut off and never cover the next message. On a bubble without such a point, reactions sit in their usual place under the bubble.

A mint-green speech bubble with a leaf sprig in a notch at its top right, saying See you at the gate, with heart and thumbs-up reactions hanging below its left side, and an incoming bubble below it facing the other way
Reactions hang from the style's reactions point

Cards

Everyone

Cards inside a styled bubble (code blocks, link previews, files, polls, lists, places and contacts) stay rectangular so what they hold is easy to read. Each gets a header that wears the theme over a solid panel. The header is at least 36 dp tall so its buttons keep a full tap size, and its words are shaded if they would not read at 4.5 to 1. Code keeps its own colours on its own panel. In the fallback bubble, cards keep their themed header.

A shaped mint-green bubble holding a poll card with a dark green header reading Poll over a white panel, and the caption Vote by Friday below
A poll in a shaped bubble, with a themed header
The card is a block, placed at no less than 160 dp wide. Its header colour comes from the style's cards settings (see Themed card headers).

Right-to-left text

Everyone

Hebrew, Arabic and other right-to-left text flows through the shape the same way. Each line sits at the right of its span, and the whole message takes its direction from its first letter that has one. Emoji, accented letters and other combined characters are never split across lines.

Two bee bubbles with Hebrew text aligned to the right, one outgoing and one incoming
Hebrew in a bee bubble, both sides
A mint-green shaped bubble with two lines of Hebrew aligned to the right, the first line shorter beside the leaf notch
The first line keeps clear of the notch

Selecting, copying and screen readers all work on the original message. Copying gives exactly the characters that were sent, and a screen reader reads the whole message once, in order.

Their bubbles

Everyone

Your bubbles sit on the right and theirs on the left, so a character usually faces the other way on their side. A style made of frame pieces is mirrored as a whole on their bubbles: the outline, the pieces, the areas kept clear of text and the reactions point all flip together, and the words stay readable. Isolink's characters work this way. A character drawn as one picture needs separately drawn art for their side, as the earlier shaped characters had.

Two red train bubbles: yours with the engine on the right, and theirs with the engine on the left
The train faces forward on both sides
The mint-green bubble mirrored: the leaf notch is at the top left and the tail at the bottom left, with the text flowing round it
A pieces style, mirrored for their side

Reduced motion and loading

Everyone

The layout never depends on animation. Space kept clear around a moving decoration covers every position it moves through, so the words never jump. When you ask your device for less motion, the bubble shows its still image and the text sits exactly where it would otherwise.

A tall green snake bubble on a dark background with a long message, shown still
Dark, with reduced motion
While a shaped bubble's outline picture is still loading, its content is not shown and can't be tapped. It appears once the outline is known, so nothing moves or changes under your finger. Taps count only inside the shape: taps on art outside it reach whatever is behind the bubble.

Layout guides

Designers

In the bubble designer, the Layout guides button (the grid icon) draws how a message was laid out: the free area words may use in green, areas kept clear in red, each line in blue, the time in amber and blocks such as photos in purple. Turn it on while you adjust a shape. Every bubble should show its content flowing, not falling back to the plain rectangle.

A capybara bubble with layout guides: a green free area filling the tall body, a blue box around each line of text and an amber box around the time
The free area and each line
The mint-green bubble with layout guides: the first line stops short of a red circle round the leaf, and the lines below run the full width
A kept-clear area (red) shortens the first line

Framed characters

Developers

A framed character is a frame of pieces with no clip: four corner pictures that keep their size and four edge pictures that stretch between them, drawn round an ordinary body. With flip: true and "mirror": true on their part, one style serves both sides. This is the Red Panda's bubble, with the pictures left out:

Two messages in the Red Panda bubbles, theirs on the left with the panda mirrored
Theirs is a mirrored copy of yours
"parts": {
  "mine": {"ref": "red-panda"},
  "theirs": {"ref": "red-panda", "mirror": true}
},
"bubbles": {
  "red-panda": {
    "v": 2, "id": "red-panda", "name": "Red Panda", "flip": true,
    "body": {"fill": "colour", "c": 4294898136},
    "border": {"fill": "none", "w": 0, "r": 19},
    "shape": {"corners": [19, 19, 19, 19], "tail": {"at": "none"}},
    "frame": {
      "padding": [0, 0, 0, 0],
      "bleed": [0.15, 9.6, 1.72, 0.9],
      "bodyRect": [2, 2, 2, 2],
      "radius": [8, 8, 8, 8],
      "pieces": {
        "topLeft": {"width": 28, "height": 23.5, "img": "…"},
        "topRight": {"width": 28, "height": 23.5, "img": "…"},
        "bottomLeft": {"width": 28, "height": 15, "img": "…"},
        "bottomRight": {"width": 28, "height": 15, "img": "…"},
        "top": {"height": 12.5, "fit": "stretch", "img": "…"},
        "bottom": {"height": 4, "fit": "stretch", "img": "…"},
        "left": {"width": 3, "fit": "stretch", "img": "…"},
        "right": {"width": 4.5, "fit": "stretch", "img": "…"}
      }
    },
    "text": {"c": 4283906087, "readable": false, "links": "text"},
    "media": {"fit": "plate", "inset": 8},
    "emoji": {"bare": true, "max": 3}
  }
}

The pieces are drawn at twice their size in dp, so a 28 by 23.5 dp corner is a 56 by 47 px PNG. bleed lets the art reach past the body, here 9.6 dp above it for the panda's ears. Copying a character in Theme Studio gives you a pack with these bubbles and the matching background, ready to change.

Silhouettes

Developers

A style counts as shaped, and flows its content, when it has any one of these:

Any other style lays out as an ordinary rounded rectangle. These fields are described in full in sections 4.5, 4.5.1, 4.12, 4.13 and 4.14 of the theme pack spec.

Frame pieces

A frame of pieces is up to eight pictures: four corners (topLeft, topRight, bottomLeft, bottomRight) that keep a fixed size in dp, and four edges (top, left, right, bottom) that stretch or repeat between them. Corners need width and height, top and bottom edges height, side edges width, each 0.5 to 128 dp. Edges take fit (stretch or repeat), and any piece an overlap of 0 to 8 dp. The frame also takes padding, bleed and bodyRect (each [left, top, right, bottom], 0 to 128 dp), radius, minSize ([width, height], 0 to 512 dp), a compact set of pieces for short bubbles, and the silhouette clip.

The silhouette (clip)

clip gives the body its real shape. Draw it on an authoring canvas. The canvas is cut in nine by slice and laid over the frame box with the same geometry as the pieces, so their outlines stay aligned:

FieldRuleMeaning
pathUp to 8192 characters; exactly one of path and imgAn SVG path d using M, L, H, V, C, S, Q, T and Z, absolute or relative. No arcs (A): draw them as cubic curves. It must start with a move, with at most 256 segments and 4 subpaths.
size[width, height], each above 0 and at most 2048; required with pathThe path's canvas, in path units.
rulenonzero (default) or evenodd; only with pathHow subpaths fill. Holes are outside the shape for every purpose.
imgA PNG, at most 512 px a sideThe silhouette as an alpha mask. Alpha of 50% or more is inside. Its canvas is the PNG's own size.
slice[left, top, right, bottom]; whole pixels 0 to 512 for a mask, any number 0 to 2048 for a pathThe fixed regions. Left plus right must be less than the canvas width, and top plus bottom less than its height. Default: a third of each side.
scale1 to 4, default 2Canvas units per dp.

A complete shaped style

Developers

Pebble is a speech bubble with a bite out of its top right corner, where a leaf sprig sits. It uses one frame piece (the sprig), a vector silhouette, an exclusion round the sprig, a reactions point and a themed card header. The notch is inside the top right fixed region, so it keeps its size however long the message is. One style serves both sides: with flip: true their bubbles are mirrored.

The Pebble bubble holding a four-line message, the first line ending before the leaf notch
Light
Two Pebble bubbles on a dark background, one outgoing with reactions and one incoming mirrored
Dark, both sides
{
  "v": 2,
  "id": "pebble_pack",
  "name": "Pebble",
  "parts": {"mine": {"ref": "pebble"}},
  "bubbles": {
    "pebble": {
      "id": "pebble",
      "name": "Pebble",
      "v": 2,
      "body": {"fill": "colour", "c": 4293128935},
      "border": {"fill": "colour", "c": 4281236815, "w": 2, "line": "solid"},
      "text": {"c": 4279710239, "readable": true},
      "frame": {
        "pieces": {"topRight": {"img": "sprig", "width": 24, "height": 24}},
        "padding": [4, 2, 6, 8],
        "minSize": [120, 56],
        "clip": {
          "path": "M24 0 H174 C181 0 186 5 186 12 C186 36 204 54 228 54 C235 54 240 59 240 66 V118 C240 128 236 134 228 140 L238 160 L206 150 H24 C11 150 0 139 0 126 V24 C0 11 11 0 24 0 Z",
          "size": [240, 160],
          "slice": [48, 64, 64, 40],
          "scale": 2,
          "rule": "nonzero"
        }
      },
      "flow": {
        "clearance": 4,
        "minLineWidth": 48,
        "exclusions": [{"shape": "ellipse", "on": "canvas", "rect": [188, 0, 52, 52]}]
      },
      "points": {"reactions": {"at": [0.2, 1], "chip": [0, 10]}},
      "cards": {
        "header": {"fill": "colour", "c": 4281236815, "text": 4294967295},
        "border": "style",
        "radius": 10
      },
      "flip": true
    }
  },
  "assets": {
    "sprig": {
      "png": "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEUAAAAaYDtMr24NaSglckY3jlgQbFgbYTsaYDoA/wAcZkASnlHGeJYSAAAADHRSTlMA8f0O/v0MXKEBWQf+zaSIAAACHUlEQVR42s1Tz2sTYRB9uxM3aaolXxKzsRAja+Mhh/ZLIpooSleM9GYbcqkoBiKlIEqCYMRTFvoHBEHUW/4H0aP04LGtqRHixcbowQpNmx8lhbRbPLRlNzEI4sU5vjfzvfnezAD/FhT5A0dAqh9MXYiAAyDel2zVWGY4l8ulqGDGh5CNJx1Zxpg3A5BBWOlzZ3T9w2Tz+NnFZEk0iMCrcRE744Bei53jgkmCjYRL20FnQzhRbm2YKt7s0yYeflxZc7R8Id3Q4PWhpt9zbGLJ+mOr7axaDMLRpFKnqu61OPSr74ynhl1lXdytFKV7y8s3nnaNAiyMKWomxDjm7iNm4NITlkjKxGSKmH9HlHWrblaMsgzHXNpkX9SdCKiPSJOlHvsk0q4p8RnMs3y619joSWVGmZpn7PHRMA4s4erqd9+3TlfdKD2/ZSaIjShrE+FnV0rh91MoAoAFACRBEPdp0QORr8Tetg9yAQDieWf1dL292bD7P23fXgIAEQB0lL+EK6PTOFNr7U5aze1qqjdjYzm3EoiPeQrGU/rO5VMvH1R+3tyrN0O117ppD0AvmItIu55IukztgoOvfvUDl+QC7jaKZpW0JhMI0kVOvW7ZWB6AhP4F5VkvBwDpaK0PNSTBLtZ7Mg9n3g3ChwGEFJmWSgOvwsbyfBDOs17qgwQAIItdbOgDNFJB+O4MlFiQ6bdbBAB0ZrfW/+6+Jfxf8Qtf647bYZtDkQAAAABJRU5ErkJggg==",
      "w": 48,
      "h": 48
    }
  }
}

How it fits together:

Availability. Silhouettes, flow, cards and reaction chip offsets need an app that includes shaped bubbles. Older apps refuse a style that uses them, with a message such as unknown frame field clip.

Text flow (flow)

Developers

A flow block sets how content keeps clear of the silhouette and the art. It is optional: any shaped style flows its content, and without a flow block the clearance is 0 and the narrowest line is 48 dp.

"flow": {"clearance": 4, "minLineWidth": 48}
FieldRuleMeaning
clearance0 to 24 dp, default 4Kept free inside the silhouette's edge and round every exclusion.
minLineWidth24 to 240 dp, default 48No line is laid narrower. A narrower span is skipped and the line moves down.
exclusionsAt most 8Areas content keeps out of, on top of the silhouette.

The content area starts as the body box minus the style's padding (the frame's padding, plus room for any border or speech tail) and a small inner margin of 10 dp at the sides and 6 dp at the top and bottom. Within that area, each line takes the widest span that is inside the silhouette (shrunk by the clearance) and outside every exclusion (grown by the clearance) across the line's whole height.

Exclusions

Developers

Add an exclusion for any art that reaches into the content area, such as a head drawn over the body or a paw.

"exclusions": [
  // shares of a layer's box: follows the layer and its animation
  {"shape": "ellipse", "on": "layer", "layer": "head", "rect": [0, 0, 1, 1]},
  // shares of the body rectangle, as your own bubble faces
  {"shape": "rect", "rect": [0.75, 0, 0.25, 0.3]},
  // a path on the frame's canvas, laid over rect (canvas units)
  {"shape": "path", "on": "canvas", "rect": [150, 0, 80, 60],
   "path": "M0 60 C10 0 70 0 80 60 Z", "size": [80, 60]}
]
FieldRuleMeaning
shaperect (default), ellipse, pathIts outline. An ellipse is held by a polygon round its outside.
onbody (default), canvas, layerWhat rect is measured on: shares of the body rectangle; units of the frame's canvas (mapped as the frame stretches, so it stays on the art); or shares of a layer's box, following the layer.
layerA layer id, only with on: "layer"The layer it follows.
rect[x, y, w, h], required, w and h above 0Where it is: shares from -1 to 2, or canvas units within ±2048.
path, sizeOnly with shape: "path"; at most 2048 characters, 64 segments and one subpath; size each side above 0 and at most 2048An outline drawn on a canvas of size, laid over rect.
envelope0 to 32 dp, optionalHow far it grows to cover motion. Left out on a layer exclusion, it is worked out from every pose of the layer's bob, scale, rotate, swing and spin animations, and those of the layer it rides.

Picture frames with a mask

Developers

The earlier built-in characters each use one nine-sliced picture frame with an alpha mask, drawn separately for each side. With under: "content" and fill: "stretch", the body fill is painted through the mask and the content flows inside it. This is the Cat's frame (asset ids are the bundled pictures; bleed values rounded):

A capybara bubble with layout guides showing a purple box round a photo and green free area in the body
A mask silhouette with guides: the photo block in purple
"frame": {
  "img": "a34192b94b0e0ae74c6f1",
  "mask": {"img": "a754755e5bed16ce9340b"},
  "slice": [77, 11, 115, 112],
  "padding": [54, 5, 72, 1],
  "bleed": [0, 0, 0, 2.34],
  "fit": "bottom",
  "fill": "stretch",
  "under": "content",
  "compact": {
    "img": "afdb26aac669354735e61",
    "mask": {"img": "a30ffbe5be34e2407f405"},
    "slice": [77, 36, 115, 68],
    "bleed": [0, 11.98, 0, 2.34],
    "maxHeight": 50
  }
},
"flow": {"clearance": 4, "minLineWidth": 48},
"points": {"reactions": {"at": [0.25, 1], "chip": [0, 12]}}

A picture frame's slice is in PNG pixels, drawn at half size. The mask must be exactly the frame picture's size. The compact art is used when the bubble is at most maxHeight dp tall. Picture frames are not mirrored by flip: give their side its own style with mirrored pictures and swapped left and right slices, padding and bleed, and name it in parts.theirs.

Reaction chip offsets

Developers

When a style has a point named reactions (or else head), a message's reaction chips are centred on it, moved by the point's chip offset.

"points": {"reactions": {"at": [0.25, 1], "chip": [0, 12]}}
FieldRuleMeaning
at[x, y], each -1 to 2, default [0.5, 0.5]A share of the body rectangle (or of a layer's box, with layer), from its top left, as your own bubble faces.
layerA layer id, optionalPut the point on that layer's box.
chip[dx, dy], each -48 to 48 dp, default [0, 0]How far the chips sit from the point, mirrored on their bubbles.

[0.25, 1] with a chip of [0, 12] hangs the chips under the inner side of the bubble, clear of the words. Particle layers on the same point keep their own anchor.offset, so chips and particles move independently. The room the chips need past the bubble is taken from the width the bubble may have.

Themed card headers (cards)

Developers

Without a cards block, cards still take the theme, with every field at its default.

"cards": {
  "header": {"fill": "body", "text": 4294967295, "img": "<paw asset id>", "size": 20},
  "border": "style",
  "radius": 10,
  "panel": 4280884240
}
FieldRuleMeaning
header.fillbody (default), colour, gradientbody repeats the style's own body in the header. colour needs header.c; gradient needs header.stops (2 to 6) and takes header.angle (0 to 360).
header.textColour, optionalThe header's words and icons. Default: the style's text colour.
header.img, header.sizePNG at most 128 px a side; size 12 to 32 dp, default 20A small picture at the header's end, drawn size dp tall. It counts toward the style's picture budget.
borderstyle (default) or nonestyle draws a 1 dp outline in the style's border colour, or the text colour at 30% when the border isn't a plain colour.
radius0 to 24 dp, default 10The card's corners.
panelColour, optionalThe card body. Used only when the style's text colour reads on it at 4.5 to 1. Otherwise, and by default, a solid near-white or near-black panel lightly tinted with the body colour.

Give a colour or gradient header when the body texture is too busy behind small words.

Verification and tolerance

Developers

Layout is bounded and checked:

Distances are in rendered dp:

CaseRule
Painted path silhouetteEach segment is cut wherever it crosses a slice boundary, so each piece maps by one stretch. The painted outline is the exact image of the path, within 0.01 dp.
Layout from a pathCurves are flattened to within 0.1 dp, then the region moves inward by 0.1 dp more: the silhouette shrinks and every exclusion grows by clearance + 0.1 dp. Path exclusions are flattened to within 0.01 of their own units. Laid-out content is always inside the painted shape.
Layout from a maskA pixel is inside at alpha 128 or more. Runs of 2 px or less are dropped. Each run is narrowed by one canvas pixel at each end, then by 0.5 dp, and a line takes only what every row it covers allows. Islands and holes are kept.
The checkEach placed rectangle is checked shrunk by 0.01 dp, for rounding.

Limits

Developers
LimitValue
Clip pathAt most 8192 characters, 256 segments and 4 subpaths; commands M L H V C S Q T Z only; starts with a move
Clip sizeEach side above 0 and at most 2048
Clip sliceWhole pixels 0 to 512 for a mask; 0 to 2048 for a path; must leave a middle
Clip scale1 to 4
Clip mask, frame piecesPNG at most 512 px a side; they count toward the style's 256 KiB of pictures
Piece sizeswidth and height 0.5 to 128 dp; overlap 0 to 8 dp
Frame insetspadding, bleed, bodyRect 0 to 128 dp; radius 0 to 48 dp; minSize 0 to 512 dp
clearance0 to 24 dp
minLineWidth24 to 240 dp
ExclusionsAt most 8 per style
Exclusion pathAt most 2048 characters, 64 segments, one subpath
Exclusion rectShares -1 to 2, or canvas units within ±2048; width and height above 0
envelope0 to 32 dp
Reaction chipEach value -48 to 48 dp
Named pointsAt most 8
Card header pictureAt most 128 px a side; size 12 to 32 dp
Card radius0 to 24 dp
SolverAt most 10 heights; at most 4 growth steps for the safe rectangle
Smallest blocksPhotos and video 120 dp wide; cards and replies 160 dp wide

The theme pack limits apply as well. Check a style with the theme pack checker, which reports errors such as bad clip path, canvas exclusion needs a frame or bad chip.

Design checklist

Designers