fix(mobile): improve player bg color (#3018)
* fix(mobile): improve payer bg color * update
This commit is contained in:
@@ -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 }
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user