bubble: Add BubbleVariant::text_view_style for readable rich text - #3329
Open
Bombatomica64 wants to merge 1 commit into
Open
Bombatomica64 wants to merge 1 commit into
Bombatomica64 wants to merge 1 commit into
Conversation
TextView paints its own text color, so a TextView inside a Filled bubble drew the theme foreground on the primary surface (white on white in dark mode), with primary links and accent code backgrounds equally hidden. BubbleVariant::text_view_style returns a TextViewStyle whose text color matches the bubble; for Filled it also derives link and code colors from the text color. The per-variant text color now lives in one place and is used by both the bubble surface and the style. Closes longbridge#3326 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Sep 30, 2026
Contributor
Author
|
I've added before/after screen recordings to the Screenshot section (Android, dark theme, Kit 0.7.0 with and without this diff). Before pr3329-before.mp4After pr3329-after.mp4 |
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.
Closes #3326
Description
TextViewpaints its own text color on its root, so it does not inherit the color aBubblesets on its content. In aFilledbubble, Markdown is drawn in the themeforegroundon theprimarysurface: white on white in dark mode. Links (primary) disappear too, and code backgrounds (accent/muted) are tuned for the page, not for aprimarysurface.Changing TextView to inherit the parent color would affect every TextView in the library, so this PR takes the smaller, additive route:
BubbleVariant::text_view_style(cx)returns aTextViewStylethat matches the bubble.primary_foregroundfor Filled anddestructivefor Destructive.Filled, links use the text color (they stay underlined), and code/inline-code backgrounds are the text color at 12% opacity, so they read on theprimarysurface.BubbleVariant::text_color, used by bothBubbleContentand the new method, so they cannot drift apart. The rendered colors of every variant are unchanged.If you'd prefer TextView to inherit the surrounding text color instead, or
BubbleContentto apply this automatically, I'm happy to rework it.Screenshot
Screen recordings on Android (Redroid, dark theme) of opening a screen with Markdown in a
Filledbubble, Kit 0.7.0 with and without this diff.Before
pr3329-before.mp4
After
pr3329-after.mp4
Before: the text and link are white on the white bubble; only the
inline codechip shows. After: dark text, an underlined link, and a tinted code chip. (Filled renders at regular weight in both because of an unrelated Android variable-font issue.)Builds: demo-pr3329.
Public API
gpui_component::bubble::BubbleVariant::text_view_style(self, cx: &App) -> gpui_base::TextViewStyle: aTextViewStylewhose text, link and code colors match this bubble variant's surface, for rich text inside a bubble.How to Test
cargo test -p gpui-component --features test-support --lib: 579 passed. The newtext_view_style_matches_the_bubble_surfacechecks, in the dark theme, that Filled usesprimary_foregroundfor text and links with a code background distinct fromprimary, that Outline keepsforegroundand the theme link color, and that Destructive usesdestructive.cargo doc -p gpui-component --no-depsreports nothing forbubble.rs. The existing warnings are in other files.Usage:
Checklist
cargo runfor story tests related to the changes. (Not run: no desktop session here; see How to Test.)Thanks for taking the time to review this.
🤖 Generated with Claude Code