105 lines
2.6 KiB
TypeScript
105 lines
2.6 KiB
TypeScript
import { Platform, useColorScheme, useWindowDimensions } from "react-native"
|
|
|
|
export const appleMusic = {
|
|
pink: "#FA2D48",
|
|
background: "#000000",
|
|
elevated: "#1C1C1E",
|
|
secondary: "#2C2C2E",
|
|
label: "#FFFFFF",
|
|
secondaryLabel: "rgba(235, 235, 245, 0.6)",
|
|
tertiaryLabel: "rgba(235, 235, 245, 0.3)",
|
|
separator: "rgba(84, 84, 88, 0.65)",
|
|
tabInactive: "#8E8E93",
|
|
miniPlayer: "rgba(28, 28, 30, 0.92)",
|
|
miniPlayerLight: "rgba(255, 255, 255, 0.92)",
|
|
} as const
|
|
|
|
export const colors = {
|
|
light: {
|
|
background: "#ffffff",
|
|
foreground: "#0a0a0a",
|
|
card: "#ffffff",
|
|
muted: "#f4f4f5",
|
|
mutedForeground: "#71717a",
|
|
border: "#e4e4e7",
|
|
primary: appleMusic.pink,
|
|
primaryForeground: "#ffffff",
|
|
destructive: "#dc2626",
|
|
accent: "#f4f4f5",
|
|
accentForeground: appleMusic.pink,
|
|
coverPlaceholder: "#e3e3e3",
|
|
coverPlaceholderIcon: "rgba(60, 60, 67, 0.18)",
|
|
},
|
|
dark: {
|
|
background: appleMusic.background,
|
|
foreground: appleMusic.label,
|
|
card: appleMusic.elevated,
|
|
muted: appleMusic.secondary,
|
|
mutedForeground: appleMusic.secondaryLabel,
|
|
border: appleMusic.separator,
|
|
primary: appleMusic.pink,
|
|
primaryForeground: "#ffffff",
|
|
destructive: "#FF453A",
|
|
accent: appleMusic.secondary,
|
|
accentForeground: appleMusic.pink,
|
|
coverPlaceholder: "#323232",
|
|
coverPlaceholderIcon: "rgba(235, 235, 245, 0.16)",
|
|
},
|
|
} as const
|
|
|
|
export type ThemeColors = (typeof colors)[keyof typeof colors]
|
|
|
|
export function useThemeColors(): ThemeColors {
|
|
return useIsDark() ? colors.dark : colors.light
|
|
}
|
|
|
|
export function useIsDark(): boolean {
|
|
const scheme = useColorScheme()
|
|
return Platform.OS === "android" || scheme === "dark"
|
|
}
|
|
|
|
export function useBlurTint(): "light" | "dark" {
|
|
return useIsDark() ? "dark" : "light"
|
|
}
|
|
|
|
export function useMiniPlayerBackground(): string {
|
|
return useIsDark() ? appleMusic.miniPlayer : appleMusic.miniPlayerLight
|
|
}
|
|
|
|
export const spacing = {
|
|
xs: 4,
|
|
sm: 8,
|
|
md: 12,
|
|
lg: 16,
|
|
xl: 24,
|
|
xxl: 32,
|
|
} as const
|
|
|
|
export const radius = {
|
|
sm: 6,
|
|
md: 10,
|
|
lg: 14,
|
|
xl: 20,
|
|
full: 9999,
|
|
} as const
|
|
|
|
export const miniPlayerHeight = 56
|
|
export const tabletMiniPlayerHeight = 68
|
|
export const tabBarHeight = Platform.OS === "ios" ? 49 : 80
|
|
export const playerBarHeight = miniPlayerHeight
|
|
export const carouselCardWidth = 160
|
|
|
|
export function useTwoColumnCardWidth(
|
|
horizontalPadding = spacing.lg,
|
|
gap = spacing.md
|
|
) {
|
|
const { width } = useWindowDimensions()
|
|
return Math.floor((width - horizontalPadding * 2 - gap) / 2)
|
|
}
|
|
|
|
export function useBottomContentInset(hasMiniPlayer: boolean) {
|
|
const base = spacing.lg
|
|
if (!hasMiniPlayer) return base
|
|
return miniPlayerHeight + tabBarHeight + spacing.lg
|
|
}
|