feat(link-pill): add optional icon tint - #921
Open
hryhoriiK97 wants to merge 5 commits into
Open
hryhoriiK97 wants to merge 5 commits into
hryhoriiK97 wants to merge 5 commits into
Conversation
`pill.iconTintColor` replaces the colors of a pill's icon and keeps its alpha; omitting it keeps the image's own colors. It applies to local and remote icons and leaves the cached image untouched. The option and its Android and Jest tests come from #863, ported to the nested `pill` configuration. Android sets the tint on the shared icon paint for every icon, tinted or not, so one pill cannot tint the next. Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 4, 2026
The variant's `pill.iconTintColor` tinted whatever icon a pill showed, so an icon supplied through `linkPillContent` (an avatar, say) became a silhouette in the tint color. The variant tint now applies only to the variant's own icon. A `linkPillContent` entry can carry its own `iconTintColor`: it tints the entry's icon, or recolors the variant's icon for that one link when the entry has no icon. Also covers transparent and half-transparent tints in the iOS tests, documents the rule, and adds an icon with a tint control to the Storybook pill story. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
4 of 6 tasks
# Conflicts: # packages/react-native-enriched-markdown/android/src/main/java/com/swmansion/enriched/markdown/spans/LinkPillSpan.kt
# Conflicts: # packages/react-native-enriched-markdown/__tests__/ios/ENRMLinkPillAttachmentTests.mm # packages/react-native-enriched-markdown/android/src/test/java/com/swmansion/enriched/markdown/spans/LinkPillSpanTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What/Why?
Adds an optional icon tint to link pills: a color that replaces the colors of a pill's icon and keeps its alpha. Omitting it keeps the image's own colors. It works for local and remote icons.
This replaces #863. The option and its Jest tests are @juliusmarminge's; they are ported here to the reworked pill implementation, where
pillis a nested object on the native link variant. Stacked onfeat/link-pills(#920), so the diff shows only the tint.One rule was added on top of #863: the variant's tint applies only to the variant's own icon. In #863 it tinted whatever icon the pill showed, so an icon supplied per link through
linkPillContent(an avatar, say) became a silhouette in the tint color.API
pill.iconTintColortints the variant's icon.linkPillContent[url].iconTintColortints that link's icon. WithiconUriit tints the entry's icon; without it, it recolors the variant's icon for that one link.transparent, is applied as the tint.transparenthides the icon's pixels and keeps its space.Implementation
iconTintColoris added toLinkPillStyleand toLinkPillContent, normalized as a color and passed in the nestedpillstruct and in thelinkPillContententries of both native component specs. It is optional on the native side, so "no tint" and "transparent" stay distinct.LinkPillStylebuilds one source-in color filter per variant; a span builds its own only for a per-link tint. Pills share a single icon paint, so the filter is set for every icon, tinted or not; otherwise one tinted pill would tint the next.imageWithTintColor:. The tint is part of the drawn-pill cache key.Testing
CI does not run on this PR, because the workflow only triggers for PRs that target
main; it runs on #920 once this is merged into the branch. Run locally on this head:The Storybook "Pills" story now shows an icon with a tint control.
PR Checklist
🤖 Generated with Claude Code