feat(chat): timestamps and readable username colors#83
Merged
ImpulseB23 merged 2 commits intomainfrom Apr 19, 2026
Merged
Conversation
Prefix each message with a 24h HH:MM timestamp (local time, fed into Pretext so wrapping stays exact) and lift low-luminance user colors above a WCAG threshold so deep blues/blacks stay readable on the dark background.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Adds a timestamp prefix and ensures username colors remain readable on the dark chat background, while keeping Pretext-based measurement aligned with DOM rendering for the virtualized chat feed.
Changes:
- Introduces
formatTimestampandnormalizeUserColorutilities (with unit tests). - Prepends timestamps during Pretext layout preparation and exposes the timestamp on
PreparedMessage. - Renders the timestamp in
ChatFeedand applies normalized username colors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/desktop/src/lib/messageStyle.ts | Adds timestamp formatting and username color normalization utilities. |
| apps/desktop/src/lib/messageStyle.test.ts | Adds unit tests for timestamp formatting and color normalization behavior. |
| apps/desktop/src/lib/messageLayout.ts | Prepends a timestamp item to Pretext measurement and returns the timestamp in PreparedMessage. |
| apps/desktop/src/components/ChatFeed.tsx | Renders the timestamp before badges and normalizes username colors. |
Store the trailing space inside PreparedMessage.timestamp and render it verbatim instead of using margin-right, so Pretext's measured prefix width matches the DOM exactly.
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.
Adds a 24h
HH:MMtimestamp prefix to every chat message and normalizes Twitch user colors so low-luminance picks (deep blues, near-black) stay readable on the dark background.Changes
lib/messageStyle.tswithformatTimestampandnormalizeUserColor(WCAG relative-luminance lift, threshold 0.20).prepareMessageprepends the timestamp as a non-breaking text item so Pretext measures wrapping exactly (heights stay pixel-perfect per ADR 2/21).ChatFeedrenders the timestamp span before badges and applies the normalized color to the username span. Fallback color is unchanged (#9147ff).Checks
bun run typecheck✓bun run lint✓bun run test✓ (42/42)