fix(mobile): make album and playlist text readable on cover-art backgrounds #30

Merged
joshuafhiggins merged 2 commits from t3code/apple-music-cover-colors into main 2026-10-17 15:22:39 -04:00
Owner

Album and playlist pages tinted their background from the cover art, but the text stayed the theme's gray and black. On Civilization VI the page turned brown and the artist, genre/year, track numbers, subtitles and durations nearly vanished. Light covers like Civilization VII also got a muddy brown page. The cause: on iOS we used primary as the background. In react-native-image-colors that's a text color picked to contrast with the art's actual background.

Pages now pick colors the way Apple Music does:

  • Background: the color the art bleeds into (iOS background, Android dominant). It's nudged out of the mid-luminance band where neither white nor black text can reach 7:1. In dark mode it's capped so white covers don't produce a blinding page.
  • Text: primary and secondary text start from the art's own colors and are adjusted in OKLab. Primary aims for 10:1 and is guaranteed at least 7:1. Secondary is at least 4.5:1 and always softer than primary.
  • Accents: the Play button, artist link, active star and subscribe button use the most colorful swatch that still reads at 3:1 without changing its look. Otherwise they fall back to a monochrome button in the primary text color.
  • Everything else: dividers, button surfaces, the header back tint, the scroll indicator and the status bar follow the palette. Covers that are missing or fail to load fall back to the normal theme.

Civilization VI before and after

Before vs after in light and dark mode: Civ VI, Civ VII, Civ V, Early American Choral Music, evermore, Les Misérables

Rendering cost: swatches are extracted once per cover from the 64px image and cached in memory and in the persistent cache, so revisits are instant. Extraction starts from the route id alongside the detail query. The screen waits for the palette (up to 400 ms) before leaving the skeleton, so the memoized rows from #28 render once with their final colors instead of flashing from theme colors.

Tested on the iPhone 18 Pro simulator in light and dark mode with the albums above, a cover-less album, and the 2,000-song playlist. pnpm --filter @otunes/mobile typecheck passes.

Album and playlist pages tinted their background from the cover art, but the text stayed the theme's gray and black. On Civilization VI the page turned brown and the artist, genre/year, track numbers, subtitles and durations nearly vanished. Light covers like Civilization VII also got a muddy brown page. The cause: on iOS we used `primary` as the background. In `react-native-image-colors` that's a text color picked to contrast with the art's actual `background`. Pages now pick colors the way Apple Music does: - **Background:** the color the art bleeds into (iOS `background`, Android `dominant`). It's nudged out of the mid-luminance band where neither white nor black text can reach 7:1. In dark mode it's capped so white covers don't produce a blinding page. - **Text:** primary and secondary text start from the art's own colors and are adjusted in OKLab. Primary aims for 10:1 and is guaranteed at least 7:1. Secondary is at least 4.5:1 and always softer than primary. - **Accents:** the Play button, artist link, active star and subscribe button use the most colorful swatch that still reads at 3:1 without changing its look. Otherwise they fall back to a monochrome button in the primary text color. - **Everything else:** dividers, button surfaces, the header back tint, the scroll indicator and the status bar follow the palette. Covers that are missing or fail to load fall back to the normal theme. ![Civilization VI before and after](https://files.gitcoffee.dev/files/civ6-before-after-e3thnpble9ebdc96.png) ![Before vs after in light and dark mode: Civ VI, Civ VII, Civ V, Early American Choral Music, evermore, Les Misérables](https://files.gitcoffee.dev/files/cover-colors-comparison-1xtwd73dtby4n512.png) **Rendering cost:** swatches are extracted once per cover from the 64px image and cached in memory and in the persistent cache, so revisits are instant. Extraction starts from the route id alongside the detail query. The screen waits for the palette (up to 400 ms) before leaving the skeleton, so the memoized rows from #28 render once with their final colors instead of flashing from theme colors. Tested on the iPhone 18 Pro simulator in light and dark mode with the albums above, a cover-less album, and the 2,000-song playlist. `pnpm --filter @otunes/mobile typecheck` passes.
joshuafhiggins added 2 commits 2026-10-17 15:19:21 -04:00
joshuafhiggins force-pushed t3code/apple-music-cover-colors from 13654cbedd to 4f74b3c3e0 2026-10-17 15:19:21 -04:00 Compare
joshuafhiggins merged commit f287253306 into main 2026-10-17 15:22:39 -04:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joshuafhiggins/otunes#30