Skip to content

Let a custom tag show a small image before its text - #23

Merged
servercimen merged 1 commit into
feature/voiceoverfrom
feature/tag-image
Nov 20, 2026
Merged

servercimen merged 1 commit into
feature/voiceoverfrom
feature/tag-image

Conversation

@servercimen

@servercimen servercimen commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

A pill tag often shows a small icon before its label, but a TranscriptDecoration could not hold an image.

  • TranscriptDecoration.image takes a TranscriptTagImage: a CGImage, its size in points, the gap to the text, and an optional tint for template images.
  • The image takes room after the tag's padding, laid out like the padding as extra spacing before the tag, so the tag's shapes surround it. A tag that starts a line moves the line over, as padding does.
  • It is drawn just before the text, centred on the text's cap height, and hidden with the tag's shapes while the tag's animation plays.
  • The README's custom tags section has an example.

Closes #7.

Stack

This PR is part of a stack. It is based on #22 (feature/voiceover), so its diff shows only this change. Merge the stack in order, starting with #17.

Tests

  • Four new unit tests: the room before the text, the image's place on the cap height, a pixel test that the image is drawn, and the tint. swift test: 140 tests pass.
  • The package builds for iOS. The drawing code is shared, so the macOS pixel test covers it.

🤖 Generated with Claude Code

A pill tag often shows a small icon before its label, but a
TranscriptDecoration could not hold an image.

TranscriptDecoration.image takes a TranscriptTagImage: a CGImage, its size
in points, the gap to the text and an optional tint for template images.
The image takes room after the tag's padding, laid out like the padding as
extra spacing before the tag, so the tag's shapes surround it. It is drawn
just before the text, centred on the text's cap height, and it is hidden
with the tag's shapes while the tag's animation plays.

Closes #7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let a custom tag show a small image next to its text

1 participant