11import * as React from 'react'
22import Color from 'color'
3- import { Theme , useTheme } from 'react-native-paper'
3+ import { useTheme } from 'react-native-paper'
44
55// 250? when bigger?
66export const circleSize = 215
@@ -157,17 +157,23 @@ export function getAngle(left: number, top: number, size: number) {
157157}
158158
159159export function useSwitchColors ( highlighted : boolean ) {
160- const theme : Theme = useTheme ( )
161-
160+ const theme = useTheme ( )
162161 const backgroundColor = React . useMemo < string > ( ( ) => {
163162 if ( theme . dark ) {
164163 if ( highlighted ) {
165164 return Color ( theme . colors . primary ) . hex ( )
166165 }
166+ if ( theme . isV3 ) {
167+ return Color ( theme . colors . surface ) . lighten ( 1.2 ) . hex ( )
168+ }
167169 return theme . colors . backdrop
168170 }
169171
170172 if ( highlighted ) {
173+ if ( theme . isV3 ) {
174+ return theme . colors . primaryContainer
175+ }
176+
171177 return Color ( theme . colors . primary ) . lighten ( 1 ) . hex ( )
172178 }
173179 return theme . colors . surface
@@ -177,9 +183,11 @@ export function useSwitchColors(highlighted: boolean) {
177183 if ( highlighted && ! theme . dark ) {
178184 return theme . colors . primary
179185 }
180-
186+ if ( highlighted && theme . dark ) {
187+ return theme . colors . background
188+ }
181189 if ( theme . isV3 ) {
182- return theme . colors . primary
190+ return theme . colors . onSurfaceVariant
183191 } else {
184192 return theme . colors . placeholder
185193 }
@@ -199,16 +207,29 @@ export function useInputColors(highlighted: boolean) {
199207 }
200208
201209 if ( highlighted ) {
210+ if ( theme . isV3 ) {
211+ return Color ( theme . colors . primaryContainer ) . hex ( )
212+ }
202213 return Color ( theme . colors . primary ) . lighten ( 1 ) . hex ( )
203214 }
215+ if ( theme . isV3 ) {
216+ return Color ( theme . colors . outline ) . lighten ( 0.9 ) . hex ( )
217+ }
204218 return Color ( theme . colors . surface ) . darken ( 0.1 ) . hex ( )
205219 } , [ highlighted , theme ] )
206220
207221 const color = React . useMemo < string > ( ( ) => {
208222 if ( highlighted && ! theme . dark ) {
209223 return theme . colors . primary
210224 }
211- return theme . colors . text
225+ if ( theme . isV3 ) {
226+ if ( ! highlighted ) {
227+ return theme . colors . onBackground
228+ }
229+ return theme . colors . background
230+ } else {
231+ return theme . colors . text
232+ }
212233 } , [ highlighted , theme ] )
213234
214235 return { backgroundColor, color }
0 commit comments