Skip to content

Keep modal and peer-row surfaces readable under the theme's text - #891

Open
awizardxch wants to merge 1 commit into
xch-dev:mainfrom
awizardxch:awizard-theme-contrast
Open

awizardxch wants to merge 1 commit into
xch-dev:mainfrom
awizardxch:awizard-theme-contrast

Conversation

@awizardxch

Copy link
Copy Markdown
Contributor

Problem

Themes with a background image set --background to transparent so the image shows through. Two surfaces then fall back to --secondary:

  • App modals (AppModalShell / SystemModalShell via resolveBackgroundTint): the first non-transparent candidate after --background is --secondary.
  • Mobile peer rows (PeerList MobileRow): painted with --secondary directly, opaque so the swipe-to-delete trash can stays hidden.

A theme whose secondary is light under light text, such as the minted awizard theme (secondary: #f5f5f5, foreground: #e0f7ff), shows white bridge-approval modals and white peer rows with near-invisible text. The theme is an NFT, so its JSON can't be edited.

Change

Both places now pick the first theme surface that is opaque enough and has at least 3:1 contrast with --foreground. Colors are read through the browser's own parser, so hex, rgb(), hsl() and bare HSL channels all work.

  • Modal tint: --background, --secondary, --muted, --card, then --popover, the theme's own floating-surface color, added before the hard fallback.
  • Peer row: --secondary is kept whenever it is readable, then --popover, --card, --background.
  • No readable candidate: the fallback is chosen against the text color: #1d2530 under light text, #ffffff under dark text. It is never white under white text.

Themes whose current choice is already readable are unchanged. A check in a browser engine with real theme values:

Theme Modal Peer row
awizard --popover (dark) --popover (dark)
dark HSL theme --background (unchanged) --secondary (unchanged)
light theme --background (unchanged) --secondary (unchanged)
every surface light under light text #1d2530 #1d2530

tsc -p tsconfig.app.json, eslint and prettier pass on the touched files.

🤖 Generated with Claude Code

Themes with a background image set --background to transparent. The app
modal shell then took --secondary as its panel tint, and the mobile peer
rows paint with --secondary directly. A theme whose secondary is light under
light text (the minted awizard theme: #f5f5f5 under #e0f7ff) showed white
panels with unreadable text in the bridge approval modals and white peer rows
on mobile.

Both now pick the first theme surface that is opaque enough and contrasts at
least 3:1 with --foreground: the modal tries background, secondary, muted,
card, then popover; the peer row keeps secondary when readable, then popover,
card, background. When nothing qualifies the fallback is chosen against the
text color (dark under light text, white under dark text), never white under
white. Themes whose current choice is readable are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant