Skip to content

feat(chat): timestamps and readable username colors#83

Merged
ImpulseB23 merged 2 commits intomainfrom
feat/message-timestamps-color
Apr 19, 2026
Merged

feat(chat): timestamps and readable username colors#83
ImpulseB23 merged 2 commits intomainfrom
feat/message-timestamps-color

Conversation

@ImpulseB23
Copy link
Copy Markdown
Owner

Adds a 24h HH:MM timestamp 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

  • New lib/messageStyle.ts with formatTimestamp and normalizeUserColor (WCAG relative-luminance lift, threshold 0.20).
  • prepareMessage prepends the timestamp as a non-breaking text item so Pretext measures wrapping exactly (heights stay pixel-perfect per ADR 2/21).
  • ChatFeed renders the timestamp span before badges and applies the normalized color to the username span. Fallback color is unchanged (#9147ff).
  • Unit tests cover formatter padding, NaN guard, hex parsing (3/6 digit, invalid), pass-through for readable colors, and lift for black / deep blue.

Checks

  • bun run typecheck
  • bun run lint
  • bun run test ✓ (42/42)

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.
Copilot AI review requested due to automatic review settings April 19, 2026 03:02
@github-actions github-actions bot added typescript Frontend/TypeScript changes size/m 100-500 lines changed labels Apr 19, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 formatTimestamp and normalizeUserColor utilities (with unit tests).
  • Prepends timestamps during Pretext layout preparation and exposes the timestamp on PreparedMessage.
  • Renders the timestamp in ChatFeed and 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.

Comment thread apps/desktop/src/lib/messageLayout.ts Outdated
Comment thread apps/desktop/src/components/ChatFeed.tsx Outdated
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.
@ImpulseB23 ImpulseB23 merged commit 3a525c0 into main Apr 19, 2026
13 checks passed
@ImpulseB23 ImpulseB23 deleted the feat/message-timestamps-color branch April 19, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m 100-500 lines changed typescript Frontend/TypeScript changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants