fix(mobile): improve player bg color (#3018)

* fix(mobile): improve payer bg color

* update
This commit is contained in:
Stephen Zhou
2025-03-11 02:32:36 +00:00
committed by GitHub
parent 9e7cd04411
commit f991e915c9
2 changed files with 14 additions and 7 deletions
+6 -5
View File
@@ -17,13 +17,14 @@ export function useCoverGradient(url?: string) {
return defaultBackgroundColor
}, [imageColors])
const isGradientLight = useMemo(() => {
return getLuminance(backgroundColor) > 0.5
const gradientColors = useMemo(() => {
const shadedColor = shadeColor(backgroundColor, -51)
return [shadedColor, shadedColor] as const
}, [backgroundColor])
const gradientColors = useMemo(() => {
return [backgroundColor, shadeColor(backgroundColor, -50)] as const
}, [backgroundColor])
const isGradientLight = useMemo(() => {
return getLuminance(gradientColors[0]) > 0.5
}, [gradientColors])
return { isGradientLight, gradientColors }
}
+8 -2
View File
@@ -14,7 +14,7 @@ import { SheetScreen } from "react-native-sheet-transitions"
import { gentleSpringPreset } from "../constants/spring"
import { useActiveTrack, useIsPlaying } from "../lib/player"
import { PlayerScreenContext } from "../modules/player/context"
import { PlayerScreenContext, usePlayerScreenContext } from "../modules/player/context"
import { ControlGroup, ProgressBar, VolumeBar } from "../modules/player/control"
import { useCoverGradient } from "../modules/player/hooks"
import { usePrefetchImageColors } from "../store/image/hooks"
@@ -99,9 +99,15 @@ export default function PlaterScreen() {
}
function DismissIndicator() {
const { isBackgroundLight } = usePlayerScreenContext()
return (
<View className="top-safe-offset-2 absolute inset-x-0 flex items-center justify-center">
<View className="bg-tertiary-label h-[5] w-[40] rounded-full" />
<View
className={cn(
"h-[5] w-[40] rounded-full",
isBackgroundLight ? "bg-black/60" : "bg-white/60",
)}
/>
</View>
)
}