diff options
author | Hailey <me@haileyok.com> | 2024-02-06 11:43:51 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-06 11:43:51 -0800 |
commit | ec86282403ea34704d0faab7b04ca033bd3a0650 (patch) | |
tree | ca5881ada59d7ad634bd799efe3c751a4c5509d2 /src/view/screens/Settings.tsx | |
parent | 856f80fc6df731b1dbe9efa289ad6a4f728d4e0d (diff) | |
download | voidsky-ec86282403ea34704d0faab7b04ca033bd3a0650.tar.zst |
Options for selecting dark theme, fix some white flashes when in dark mode (#2722)
* add dark theme selection to settings/schema * use `useThemePrefs` where needed * adjust theme providers to support various themes * update storybook * handle web themes * better themeing for web * dont show dark theme prefs when color mode is light * drop the inverted text change on oled theme * get the color mode inside of `useColorModeTheme` * use `ThemeName` type everywhere * typo * use dim/dark instead of dark/oled * prevent any fickers on web * fix styles * use `dim` for dark default * more cleanup * 🤔 * set system background color * ts
Diffstat (limited to 'src/view/screens/Settings.tsx')
-rw-r--r-- | src/view/screens/Settings.tsx | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/view/screens/Settings.tsx b/src/view/screens/Settings.tsx index 17e4b45c5..104506576 100644 --- a/src/view/screens/Settings.tsx +++ b/src/view/screens/Settings.tsx @@ -40,8 +40,8 @@ import {RQKEY as RQKEY_PROFILE} from '#/state/queries/profile' import {useModalControls} from '#/state/modals' import { useSetMinimalShellMode, - useColorMode, - useSetColorMode, + useThemePrefs, + useSetThemePrefs, useOnboardingDispatch, } from '#/state/shell' import { @@ -144,8 +144,8 @@ function SettingsAccountCard({account}: {account: SessionAccount}) { type Props = NativeStackScreenProps<CommonNavigatorParams, 'Settings'> export function SettingsScreen({}: Props) { const queryClient = useQueryClient() - const colorMode = useColorMode() - const setColorMode = useSetColorMode() + const {colorMode, darkTheme} = useThemePrefs() + const {setColorMode, setDarkTheme} = useSetThemePrefs() const pal = usePalette('default') const {_} = useLingui() const setMinimalShellMode = useSetMinimalShellMode() @@ -483,8 +483,36 @@ export function SettingsScreen({}: Props) { /> </View> </View> + <View style={styles.spacer20} /> + {colorMode !== 'light' && ( + <> + <Text type="xl-bold" style={[pal.text, styles.heading]}> + <Trans>Dark Theme</Trans> + </Text> + <View> + <View style={[styles.linkCard, pal.view, styles.selectableBtns]}> + <SelectableBtn + selected={!darkTheme || darkTheme === 'dim'} + label={_(msg`Dim`)} + left + onSelect={() => setDarkTheme('dim')} + accessibilityHint={_(msg`Set dark theme to the dim theme`)} + /> + <SelectableBtn + selected={darkTheme === 'dark'} + label={_(msg`Dark`)} + right + onSelect={() => setDarkTheme('dark')} + accessibilityHint={_(msg`Set dark theme to the dark theme`)} + /> + </View> + </View> + <View style={styles.spacer20} /> + </> + )} + <Text type="xl-bold" style={[pal.text, styles.heading]}> <Trans>Basics</Trans> </Text> |