From 71a3f0ce1eb09e04a7a66079a8f4285ef5e5af5e Mon Sep 17 00:00:00 2001 From: Rishi Balakrishnan Date: Wed, 11 Nov 2026 09:46:33 -0500 Subject: [PATCH] fix(signup): follow the color scheme in account creation and onboarding (#241) * fix(signup): keep account creation and onboarding dark in light mode * fix(signup): follow the color scheme in account creation and onboarding --- src/components/onboarding-chrome/Eyebrow.tsx | 8 +++---- .../onboarding-chrome/FieldGroupCard.tsx | 5 +++-- .../onboarding-chrome/InputGroup.tsx | 17 +++++++-------- .../onboarding-chrome/SelectionRow.tsx | 21 +++++++++---------- .../__tests__/InputGroup.test.tsx | 3 +-- .../onboarding-chrome/useChromeColors.ts | 16 ++++++++++++++ src/screens/Onboarding/StepBelong/index.tsx | 6 ++++-- 7 files changed, 46 insertions(+), 30 deletions(-) create mode 100644 src/components/onboarding-chrome/useChromeColors.ts diff --git a/src/components/onboarding-chrome/Eyebrow.tsx b/src/components/onboarding-chrome/Eyebrow.tsx index 8f88507ef..72aa81a8c 100644 --- a/src/components/onboarding-chrome/Eyebrow.tsx +++ b/src/components/onboarding-chrome/Eyebrow.tsx @@ -2,12 +2,11 @@ import {View} from 'react-native' import {msg} from '@lingui/core/macro' import {useLingui} from '@lingui/react' -import {colors} from '#/lib/styles' import {atoms as a} from '#/alf' +import {useChromeColors} from '#/components/onboarding-chrome/useChromeColors' import {Text} from '#/components/Typography' const SHIM_SIZE = 13 -const LIME = colors.green2 export function Eyebrow({ step, @@ -19,6 +18,7 @@ export function Eyebrow({ label?: string }) { const {_} = useLingui() + const {accent} = useChromeColors() let text: string | undefined if (step != null && total != null) { @@ -37,7 +37,7 @@ export function Eyebrow({ style={{ width: SHIM_SIZE, height: SHIM_SIZE, - backgroundColor: LIME, + backgroundColor: accent, }} /> {text} diff --git a/src/components/onboarding-chrome/FieldGroupCard.tsx b/src/components/onboarding-chrome/FieldGroupCard.tsx index 4d1fc4a97..139641013 100644 --- a/src/components/onboarding-chrome/FieldGroupCard.tsx +++ b/src/components/onboarding-chrome/FieldGroupCard.tsx @@ -1,7 +1,7 @@ import {type StyleProp, View, type ViewStyle} from 'react-native' import {atoms as a} from '#/alf' -import {FIELD_BORDER} from '#/components/onboarding-chrome/InputGroup' +import {useChromeColors} from '#/components/onboarding-chrome/useChromeColors' export function FieldGroupCard({ children, @@ -10,6 +10,7 @@ export function FieldGroupCard({ children: React.ReactNode style?: StyleProp }) { + const c = useChromeColors() return ( ( ) { const {fonts} = useAlf() const t = useTheme() + const c = useChromeColors() const [focused, setFocused] = useState(false) const hasError = errorText != null @@ -99,7 +97,7 @@ export const InputGroup = forwardRef( a.font_mono, { fontSize: 14, - color: INPUT_TEXT_COLOR, + color: c.inputText, padding: 0, textTransform: uppercaseValue ? ('uppercase' as const) : undefined, }, @@ -111,7 +109,7 @@ export const InputGroup = forwardRef( a.align_center, a.gap_sm, { - backgroundColor: FIELD_BG, + backgroundColor: c.fieldBg, borderColor, borderWidth: 1, borderRadius: RADIUS, @@ -121,7 +119,7 @@ export const InputGroup = forwardRef( ] const iconEl = Icon ? ( - + ) : null const input = ( @@ -136,7 +134,8 @@ export const InputGroup = forwardRef( value={value} onChangeText={onChangeText} placeholder={placeholder ? placeholder.toUpperCase() : undefined} - placeholderTextColor={PLACEHOLDER} + placeholderTextColor={c.placeholder} + keyboardAppearance={t.scheme} secureTextEntry={secureTextEntry} keyboardType={keyboardType} autoCapitalize={autoCapitalize} @@ -220,7 +219,7 @@ export const InputGroup = forwardRef( marginHorizontal: -16, marginTop: 16, marginBottom: 16, - backgroundColor: FIELD_BORDER, + backgroundColor: c.fieldBorder, }} /> ) : null} diff --git a/src/components/onboarding-chrome/SelectionRow.tsx b/src/components/onboarding-chrome/SelectionRow.tsx index 7111b44a6..e8a130032 100644 --- a/src/components/onboarding-chrome/SelectionRow.tsx +++ b/src/components/onboarding-chrome/SelectionRow.tsx @@ -1,18 +1,16 @@ import {Pressable, View} from 'react-native' -import {colors} from '#/lib/styles' import {atoms as a, useTheme} from '#/alf' import {CheckThick_Stroke2_Corner0_Rounded as Checkmark} from '#/components/icons/Check' import { ChevronBottom_Stroke2_Corner0_Rounded as ChevronDown, ChevronTop_Stroke2_Corner0_Rounded as ChevronUp, } from '#/components/icons/Chevron' +import {useChromeColors} from '#/components/onboarding-chrome/useChromeColors' import {Text} from '#/components/Typography' -const LIME = colors.green2 const CONTROL_SIZE = 24 const ICON_SLOT = 40 -const SELECTED_ROW_BG = 'rgba(210, 252, 81, 0.08)' export function SelectionRow({ mode, @@ -38,6 +36,7 @@ export function SelectionRow({ emphasize?: boolean }) { const t = useTheme() + const {accent, onAccent, accentSubtle} = useChromeColors() return ( {icon != null ? ( {title} {description != null ? ( + style={[a.text_xs, a.leading_tight, {color: accent, marginTop: 2}]}> {description} ) : null} @@ -123,7 +122,7 @@ export function SelectionRow({ width: CONTROL_SIZE, height: CONTROL_SIZE, borderWidth: 2, - borderColor: selected ? LIME : t.palette.contrast_400, + borderColor: selected ? accent : t.palette.contrast_400, flexShrink: 0, }, ]}> @@ -131,7 +130,7 @@ export function SelectionRow({ ) : null} @@ -146,12 +145,12 @@ export function SelectionRow({ height: CONTROL_SIZE, borderRadius: 6, borderWidth: 2, - borderColor: selected ? LIME : t.palette.contrast_400, - backgroundColor: selected ? LIME : 'transparent', + borderColor: selected ? accent : t.palette.contrast_400, + backgroundColor: selected ? accent : 'transparent', flexShrink: 0, }, ]}> - {selected ? : null} + {selected ? : null} )} diff --git a/src/components/onboarding-chrome/__tests__/InputGroup.test.tsx b/src/components/onboarding-chrome/__tests__/InputGroup.test.tsx index 3068ad1ad..2c8b7f8a5 100644 --- a/src/components/onboarding-chrome/__tests__/InputGroup.test.tsx +++ b/src/components/onboarding-chrome/__tests__/InputGroup.test.tsx @@ -22,7 +22,6 @@ function propsOf(node: {props: unknown}) { } const NEAR_WHITE = /#F8FAF9/i -const DIVIDER_COLOR = '#464985' function collectColors(style: unknown, out: string[]) { if (Array.isArray(style)) { @@ -52,7 +51,7 @@ type JsonNode = { function hasDivider(node: JsonNode | null): boolean { if (!node || typeof node !== 'object') return false const style = flattenStyle(node.props?.style) - if (style.height === 1 && style.backgroundColor === DIVIDER_COLOR) { + if (style.height === 1 && style.marginHorizontal === -16) { return true } return (node.children ?? []).some(child => hasDivider(child)) diff --git a/src/components/onboarding-chrome/useChromeColors.ts b/src/components/onboarding-chrome/useChromeColors.ts new file mode 100644 index 000000000..5a6524772 --- /dev/null +++ b/src/components/onboarding-chrome/useChromeColors.ts @@ -0,0 +1,16 @@ +import {colors} from '#/lib/styles' +import {useTheme} from '#/alf' + +export function useChromeColors() { + const t = useTheme() + const isLight = t.name === 'light' + return { + accent: isLight ? t.palette.primary_500 : colors.green2, + onAccent: isLight ? t.palette.white : colors.black, + accentSubtle: isLight ? t.palette.primary_25 : 'rgba(210, 252, 81, 0.08)', + fieldBg: isLight ? t.palette.contrast_50 : '#262644', + fieldBorder: isLight ? t.palette.contrast_100 : '#464985', + placeholder: isLight ? t.palette.contrast_500 : '#7878A5', + inputText: isLight ? t.atoms.text.color : '#F8FAF9', + } +} diff --git a/src/screens/Onboarding/StepBelong/index.tsx b/src/screens/Onboarding/StepBelong/index.tsx index fa4f2ecfe..5a91a6ee6 100644 --- a/src/screens/Onboarding/StepBelong/index.tsx +++ b/src/screens/Onboarding/StepBelong/index.tsx @@ -16,12 +16,14 @@ import { Footer, PrimaryButton, } from '#/components/onboarding-chrome' +import {useChromeColors} from '#/components/onboarding-chrome/useChromeColors' import {Text} from '#/components/Typography' export function StepBelong() { const {_} = useLingui() const openLink = useOpenLink() const t = useTheme() + const {accent} = useChromeColors() const {state, dispatch} = useOnboardingInternalState() const agreed = state.guidelinesAccepted @@ -82,9 +84,9 @@ export function StepBelong() { a.border, a.align_center, a.justify_center, - {width: 18, height: 18, borderColor: '#D2FC51'}, + {width: 18, height: 18, borderColor: accent}, ]}> - {agreed && ✓} + {agreed && ✓}