Bluesky app fork with some witchin' additions 馃挮
witchsky.app
bluesky
fork
client
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 borderDark: ViewStyle
17 text: TextStyle
18 textLight: TextStyle
19 textInverted: TextStyle
20 link: TextStyle
21 icon: TextStyle
22}
23
24/**
25 * @deprecated use `useTheme` from `#/alf`
26 */
27export function usePalette(color: PaletteColorName): UsePaletteValue {
28 const theme = useTheme()
29 return useMemo(() => {
30 const palette = theme.palette[color]
31 return {
32 colors: palette,
33 view: {
34 backgroundColor: palette.background,
35 },
36 viewLight: {
37 backgroundColor: palette.backgroundLight,
38 },
39 btn: {
40 backgroundColor: palette.backgroundLight,
41 },
42 border: {
43 borderColor: palette.border,
44 },
45 borderDark: {
46 borderColor: palette.borderDark,
47 },
48 text: {
49 color: palette.text,
50 },
51 textLight: {
52 color: palette.textLight,
53 },
54 textInverted: {
55 color: palette.textInverted,
56 },
57 link: {
58 color: palette.link,
59 },
60 icon: {
61 color: palette.icon,
62 },
63 }
64 }, [theme, color])
65}