feat(desktop): sender-derived background tints on message rows - #6925
Open
steinermatt wants to merge 1 commit into
Open
feat(desktop): sender-derived background tints on message rows#6925steinermatt wants to merge 1 commit into
steinermatt wants to merge 1 commit into
Conversation
Each message row gets a subtle, deterministic background tint (10% opacity hsla) computed from the sender's pubkey via a djb2-style hash → hue. Every sender gets a stable, unique colour across sessions; no profile changes or relay changes required. Three-touch, frontend only: - TimelineMessage.accentColor?: string — new optional field - formatTimelineMessages: pubkeyToAccentColor() helper populates it - MessageRow: absolutely-positioned overlay div (z-index: -10, inset-0) so the tint lives behind content but above the article background; memo comparator updated to include accentColor Follow-up PR will layer canonical colours from kind:0 profiles for agents that publish an accent_color field. Signed-off-by: Matthias Steiner <matthias.steiner@inscope.net>
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.
Summary
accentColorfield is optional (string | undefined) — zero blast radius on callers that don't set it.How it works
formatTimelineMessagescallspubkeyToAccentColor(authorPubkey)which hashes the pubkey string to a 0–359 hue, then returnshsla(hue, 65%, 55%, 0.10). The resulting string is stored onTimelineMessage.accentColor.MessageRowrenders an absolutely-positioned<div aria-hidden>withz-index: -10as the first child of the<article>. Because the article creates its own stacking context (z-index: 10), the overlay lands:This means
hover:bg-muted/50,bg-blue-500/10(reminder state), and the::beforeroute-target highlight animation all still work correctly — they're separate layers, not overridden.The
React.memocomparator is updated withaccentColorso the row only re-renders when the colour actually changes (it won't — pubkeys are stable).Files changed
desktop/src/features/messages/types.tsaccentColor?: stringfield added toTimelineMessagedesktop/src/features/messages/lib/formatTimelineMessages.tspubkeyToAccentColor()helper + field populated in the mapdesktop/src/features/messages/ui/MessageRow.tsxTest plan
tsc --noEmit, exit 0)bg-muted/50still appears on hover (tint persists underneath)::before) appears above the tintbg-blue-500/10composes correctly with the tintFollow-up (separate PR)
Wire canonical colours from kind:0 profiles: agents that publish an
accent_colorfield in their Nostr profile will have that colour used instead of the hash-derived one. TheaccentColorfield onTimelineMessageis already the right hook.🤖 Generated with Claude Code