@@ -47,24 +47,44 @@ function Day(props: {
4747 onPressDate ( new Date ( year , month , day ) )
4848 } , [ onPressDate , year , month , day ] )
4949
50- const borderColor = theme . isV3
51- ? theme . colors . primary
52- : selected || ( inRange && theme . dark )
50+ // const borderColorV3 =
51+ const borderColorFallback = theme . dark ? '#fff' : '#000'
52+ const selectedOrInRangeDarkMode = selected || ( inRange && theme . dark )
53+ const v2BorderColor = selectedOrInRangeDarkMode
5354 ? textColorOnPrimary
54- : theme . dark
55- ? '#fff'
56- : '#000'
55+ : borderColorFallback
56+ const borderColor = theme . isV3 ? theme . colors . primary : v2BorderColor
5757
58- const textColor =
59- theme . isV3 && selected
60- ? theme . colors . onPrimary
61- : theme . isV3 && inRange && theme . dark
62- ? theme . colors . onPrimaryContainer
63- : selected || ( inRange && theme . dark )
64- ? textColorOnPrimary
65- : theme . isV3
66- ? theme . colors . onSurface
67- : undefined
58+ // TODO: check if this can be simplified
59+ // converted with Chat-GPT for now from enormous conditional to if-else
60+ let baseTextColor
61+ let finalTextColor
62+
63+ if ( theme . isV3 ) {
64+ // Theme V3 specific logic for base text color
65+ if ( selected ) {
66+ baseTextColor = theme . colors . onPrimary
67+ } else if ( inRange && theme . dark ) {
68+ baseTextColor = theme . colors . onPrimaryContainer
69+ } else {
70+ baseTextColor = theme . colors . onSurface
71+ }
72+
73+ // Theme V3 specific logic for final text color
74+ if ( isToday ) {
75+ finalTextColor = selected ? baseTextColor : theme . colors . primary
76+ } else {
77+ finalTextColor = baseTextColor
78+ }
79+ } else {
80+ // Logic for themes other than V3
81+ if ( selected || ( inRange && theme . dark ) ) {
82+ baseTextColor = textColorOnPrimary
83+ }
84+ // Since there's no additional logic provided for non-V3 themes in the step 2,
85+ // the final text color for non-V3 themes will simply be the base text color.
86+ finalTextColor = baseTextColor
87+ }
6888
6989 let textFont = theme ?. isV3
7090 ? theme . fonts . bodySmall
@@ -99,14 +119,9 @@ function Day(props: {
99119 < Text
100120 maxFontSizeMultiplier = { 1.5 }
101121 style = { [
102- textColor
122+ baseTextColor
103123 ? {
104- color :
105- theme . isV3 && isToday && selected
106- ? textColor
107- : theme . isV3 && isToday
108- ? theme . colors . primary
109- : textColor ,
124+ color : finalTextColor ,
110125 }
111126 : undefined ,
112127 { ...textFont } ,
0 commit comments