Skip to content

shimmer: Keep the default highlight visible on foreground text in dark mode - #3328

Merged
huacnlee merged 1 commit into
longbridge:mainfrom
Bombatomica64:fix/shimmer-dark-highlight
Oct 1, 2026
Merged

huacnlee merged 1 commit into
longbridge:mainfrom
Bombatomica64:fix/shimmer-dark-highlight

Conversation

@Bombatomica64

@Bombatomica64 Bombatomica64 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #3327

Description

Thank you for the quick feedback on #3310. This is the first of the focused fixes.

In a dark theme, ShimmerText's default highlight is the text mixed 80% toward foreground (mix_oklab's factor weights the first color). For text that already is foreground, which is the inherited default, e.g. ShimmerText::new("Thinking…") in the story, the band has the text's own color, so nothing visibly sweeps.

shimmer_highlight_color now keeps the current target (foreground in dark, background in light) unless its lightness is within 0.1 of the text's; in that case it mixes toward the opposite end. muted_foreground text, the light theme and explicit highlight_color(..) produce exactly the same color as before; only the case that was invisible changes, to a band that dims the glyphs as it passes.

Happy to change the threshold or the approach, e.g. if you'd rather always use a muted base color, as Marker does.

Screenshot

Physical Android phone, dark theme, unstyled ShimmerText::new("Thinking…") (as in the Shimmer story) above a muted_foreground one for comparison.

Before

pr3328-before.mp4

After

pr3328-after.mp4

Before: the first line never visibly changes. After: a band sweeps across it. The muted line is the same in both.
Builds: demo-pr3328 (Kit 0.7.0 with and without this diff).

How to Test

  • cargo test -p gpui-component --lib shimmer: 4 passed. The extended test_shimmer_highlight_stays_bright_in_both_themes asserts that foreground text in dark mode and background-colored text in light mode get a highlight at least 0.3 darker than the text. With the fallback disabled (threshold 0.0), that assertion fails.
  • The existing assertions for muted text in dark mode, black text in light mode and a custom highlight_color are unchanged and still pass.
  • To verify visually, open the Shimmer story in the dark theme: the first example (ShimmerText::new("Thinking…")) now shows the sweep.

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate.
  • Passed cargo run for story tests related to the changes. (Not run: no desktop session here; see How to Test.)
  • Tested macOS, Windows and Linux platforms performance (if the change is platform-specific) (not platform-specific)

Thanks for taking the time to review this.

🤖 Generated with Claude Code

…k mode

In a dark theme the default highlight mixes the text 80% toward
`foreground`. For text that already is `foreground` (the inherited
default) the band had the text's own color, so nothing visibly swept.
When the target's lightness is within 0.1 of the text's, mix toward the
opposite end (`background` in dark, `foreground` in light) instead.
Muted text and the light theme keep today's highlight.

Closes longbridge#3327

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 07:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@huacnlee

Copy link
Copy Markdown
Member

Upload video or screenshot when you have changed UI.

@Bombatomica64

Bombatomica64 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks, done. I've added before/after recordings from a physical Android phone (dark theme) to the Screenshot section above.

Before

pr3328-before.mp4

After

pr3328-after.mp4

The top line is the unstyled ShimmerText::new("Thinking…") from the story. Before, it never visibly changes; after, a band sweeps across it. The muted line below is unchanged.

@huacnlee
huacnlee merged commit b4c7cbd into longbridge:main Oct 1, 2026
11 checks passed
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.

ShimmerText: default highlight is invisible on foreground text in dark mode

4 participants