import {useCallback} from 'react' import {View} from 'react-native' import Animated, { FadeInUp, FadeOutUp, LayoutAnimationConfig, LinearTransition, } from 'react-native-reanimated' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import { type CommonNavigatorParams, type NativeStackScreenProps, } from '#/lib/routes/types' import { useEnableSquareAvatars, useSetEnableSquareAvatars, } from '#/state/preferences/enable-square-avatars' import { useEnableSquareButtons, useSetEnableSquareButtons, } from '#/state/preferences/enable-square-buttons' import {useKawaiiMode, useSetKawaiiMode} from '#/state/preferences/kawaii' import {useSetThemePrefs, useThemePrefs} from '#/state/shell' import {SettingsListItem as AppIconSettingsListItem} from '#/screens/Settings/AppIconSettings/SettingsListItem' import {type Alf, atoms as a, native, useAlf, useTheme} from '#/alf' import * as SegmentedControl from '#/components/forms/SegmentedControl' import {Slider} from '#/components/forms/Slider' import * as Toggle from '#/components/forms/Toggle' import {Circle_And_Square_Stroke1_Corner0_Rounded_Filled as SquareIcon} from '#/components/icons/CircleAndSquare' import {ColorPalette_Stroke2_Corner0_Rounded as ColorPaletteIcon} from '#/components/icons/ColorPalette' import {type Props as SVGIconProps} from '#/components/icons/common' import {Moon_Stroke2_Corner0_Rounded as MoonIcon} from '#/components/icons/Moon' import {Phone_Stroke2_Corner0_Rounded as PhoneIcon} from '#/components/icons/Phone' import {Sparkle_Stroke2_Corner0_Rounded as SparkleIcon} from '#/components/icons/Sparkle' import {TextSize_Stroke2_Corner0_Rounded as TextSize} from '#/components/icons/TextSize' import {TitleCase_Stroke2_Corner0_Rounded as Aa} from '#/components/icons/TitleCase' import * as Layout from '#/components/Layout' import {Text} from '#/components/Typography' import {IS_NATIVE} from '#/env' import {IS_INTERNAL} from '#/env' import * as SettingsList from './components/SettingsList' type Props = NativeStackScreenProps export function AppearanceSettingsScreen({}: Props) { const {_} = useLingui() const {fonts} = useAlf() const t = useTheme() const {colorMode, colorScheme, darkTheme, hue} = useThemePrefs() const {setColorMode, setColorScheme, setDarkTheme, setHue} = useSetThemePrefs() const kawaiiMode = useKawaiiMode() const setKawaiiMode = useSetKawaiiMode() const enableSquareAvatars = useEnableSquareAvatars() const setEnableSquareAvatars = useSetEnableSquareAvatars() const enableSquareButtons = useEnableSquareButtons() const setEnableSquareButtons = useSetEnableSquareButtons() const onChangeAppearance = useCallback( (value: 'light' | 'system' | 'dark') => { setColorMode(value) }, [setColorMode], ) const onChangeScheme = useCallback( ( value: | 'witchsky' | 'bluesky' | 'blacksky' | 'deer' | 'zeppelin' | 'kitty' | 'reddwarf', ) => { setColorScheme(value) }, [setColorScheme], ) const onChangeDarkTheme = useCallback( (value: 'dim' | 'dark') => { setDarkTheme(value) }, [setDarkTheme], ) const onChangeFontFamily = useCallback( (value: 'system' | 'theme') => { fonts.setFontFamily(value) }, [fonts], ) const onChangeFontScale = useCallback( (value: Alf['fonts']['scale']) => { fonts.setFontScale(value) }, [fonts], ) const colorSchemes = [ {name: 'witchsky', label: _(msg`Witchsky`)}, {name: 'bluesky', label: _(msg`Bluesky`)}, {name: 'blacksky', label: _(msg`Blacksky`)}, {name: 'deer', label: _(msg`Deer`)}, {name: 'zeppelin', label: _(msg`Zeppelin`)}, {name: 'kitty', label: _(msg`Kitty`)}, {name: 'reddwarf', label: _(msg`Red Dwarf`)}, ] return ( Appearance {colorMode !== 'light' && ( )} Color Theme Choose which color scheme to use: onChangeScheme(value as typeof colorScheme) }> {colorSchemes.map(({name, label}) => ( {label} ))} Hue shift the colors: Logo setKawaiiMode(value)} style={[a.w_full]}> Enable kawaii logo Shapes setEnableSquareAvatars(value)} style={[a.w_full]}> Enable square avatars setEnableSquareButtons(value)} style={[a.w_full]}> Enable square buttons {IS_NATIVE && IS_INTERNAL && ( <> )} ) } export function AppearanceToggleButtonGroup({ title, description, icon: Icon, items, value, onChange, }: { title: string description?: string icon: React.ComponentType items: { label: string name: T }[] value: T onChange: (value: T) => void }) { const t = useTheme() return ( <> {title} {description && ( {description} )} {items.map(item => ( {item.label} ))} ) }