forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1import {useMemo} from 'react'
2import {type TextStyle, type ViewStyle} from 'react-native'
3
4import {
5 type PaletteColor,
6 type PaletteColorName,
7 useTheme,
8} from '../ThemeContext'
9
10export interface UsePaletteValue {
11 colors: PaletteColor
12 view: ViewStyle
13 viewLight: ViewStyle
14 btn: ViewStyle
15 border: ViewStyle
16 text: TextStyle
17 textLight: TextStyle
18 textInverted: TextStyle
19 link: TextStyle
20}
21
22/**
23 * @deprecated use `useTheme` from `#/alf`
24 */
25export function usePalette(color: PaletteColorName): UsePaletteValue {
26 const theme = useTheme()
27 return useMemo(() => {
28 const palette = theme.palette[color]
29 return {
30 colors: palette,
31 view: {
32 backgroundColor: palette.background,
33 },
34 viewLight: {
35 backgroundColor: palette.backgroundLight,
36 },
37 btn: {
38 backgroundColor: palette.backgroundLight,
39 },
40 border: {
41 borderColor: palette.border,
42 },
43 text: {
44 color: palette.text,
45 },
46 textLight: {
47 color: palette.textLight,
48 },
49 textInverted: {
50 color: palette.textInverted,
51 },
52 link: {
53 color: palette.link,
54 },
55 }
56 }, [theme, color])
57}