fix(mobile): tint native playlist rows and tune cover palette contrast
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
12121144e9
commit
13654cbedd
2 files changed
+11
-9
No files matched your search
@@ -299,7 +299,10 @@ export default function PlaylistScreen() {
|
||||
listRowInsets({ top: 0, leading: 0, bottom: 0, trailing: 0 }),
|
||||
listRowSeparator("hidden"),
|
||||
]
|
||||
const nativeSongRowModifiers = [frame({ height: 32 })]
|
||||
const nativeSongRowModifiers = [
|
||||
frame({ height: 32 }),
|
||||
listRowBackground(palette.background),
|
||||
]
|
||||
const shouldUseNativeSwipeList =
|
||||
Platform.OS === "ios" && playlist.isOwner && playlist.id
|
||||
|
||||
|
||||
@@ -28,7 +28,9 @@ export type CoverSwatches = {
|
||||
accent: string[]
|
||||
}
|
||||
|
||||
const PRIMARY_MIN_CONTRAST = 7
|
||||
// Best effort: `legibleBackground` only guarantees that white or black reaches
|
||||
// 7:1, so on some backgrounds primary text settles for pure white or black.
|
||||
const PRIMARY_MIN_CONTRAST = 10
|
||||
const SECONDARY_MIN_CONTRAST = 4.5
|
||||
const SECONDARY_TO_PRIMARY_CONTRAST = 0.62
|
||||
const ACCENT_MIN_CONTRAST = 3
|
||||
@@ -97,12 +99,9 @@ export function deriveCoverPalette(
|
||||
)
|
||||
|
||||
const accent = pickAccent(swatches.accent, background) ?? foreground
|
||||
const accentForeground =
|
||||
contrastRatio(background, accent) >= SECONDARY_MIN_CONTRAST
|
||||
? background
|
||||
: contrastRatio([255, 255, 255], accent) >= contrastRatio([0, 0, 0], accent)
|
||||
? ([255, 255, 255] as Rgb)
|
||||
: ([0, 0, 0] as Rgb)
|
||||
const accentForeground: Rgb = prefersLightText(accent)
|
||||
? [255, 255, 255]
|
||||
: [0, 0, 0]
|
||||
|
||||
return {
|
||||
background: toHex(background),
|
||||
@@ -129,7 +128,7 @@ function legibleBackground(color: Rgb, schemeIsDark: boolean): Rgb {
|
||||
return clamped
|
||||
}
|
||||
|
||||
const pivot = schemeIsDark ? 0.24 : 0.16
|
||||
const pivot = schemeIsDark ? 0.28 : 0.14
|
||||
return y < pivot
|
||||
? withLuminance(clamped, DARK_BACKGROUND_MAX_LUMINANCE)
|
||||
: withLuminance(clamped, LIGHT_BACKGROUND_MIN_LUMINANCE)
|
||||
|
||||
Reference in new issue
Block a user