@@ -2,6 +2,8 @@ import SwiftUI
2
2
3
3
4
4
struct StarButtons : View {
5
+ @Environment ( \. colorScheme) var colorScheme
6
+
5
7
@Binding var selection : Int ;
6
8
7
9
let action : ( ) -> Void ;
@@ -19,6 +21,7 @@ struct StarButtons: View {
19
21
20
22
ButtonGroupView ( variant: . inclusive, options: stars, selection: $selection) { option, isSelected in
21
23
ZStack {
24
+
22
25
Image ( systemName: " star " )
23
26
. resizable ( )
24
27
. scaledToFit ( )
@@ -29,22 +32,22 @@ struct StarButtons: View {
29
32
. resizable ( )
30
33
. scaledToFit ( )
31
34
. frame ( width: isSelected ? 20 : 24 , height: isSelected ? 20 : 24 ) // Original size
32
- . foregroundColor ( isSelected ? activeStarColor : starColor)
35
+ . foregroundColor ( isSelected ? activeStarColor : colorScheme == . dark ? . gray . opacity ( 0.8 ) : starColor)
33
36
}
34
37
. frame ( maxWidth: . infinity)
35
38
. padding ( . vertical, 8 )
36
- . background ( isSelected ? activeBackgroundColor : backgroundColor)
37
- . foregroundColor ( . white)
39
+ . foregroundColor ( colorScheme == . dark ? Color ( UIColor . systemBackground. lighter ( by: 15 ) !) : . white)
38
40
. cornerRadius ( 4 )
39
41
. overlay (
40
42
RoundedRectangle ( cornerRadius: 4 )
41
- . stroke ( isSelected ? activeBorderColor : borderColor, lineWidth: 1 )
43
+ . stroke ( isSelected ? activeBorderColor : colorScheme == . dark ? . gray . opacity ( 0.8 ) : borderColor, lineWidth: 1 )
42
44
)
43
45
}
44
46
}
45
47
}
46
48
47
49
struct EmojiButtons : View {
50
+ @Environment ( \. colorScheme) var colorScheme
48
51
@Binding var selection : Int ;
49
52
50
53
let action : ( ) -> Void ;
@@ -62,18 +65,19 @@ struct EmojiButtons: View {
62
65
. shadow ( color: . init( . sRGB, red: 0 , green: 0 , blue: 0 , opacity: isSelected ? 0.35 : 0 ) , radius: 7 , x: 0 , y: 4 )
63
66
. frame ( maxWidth: . infinity)
64
67
. padding ( . vertical, 8 )
65
- . background ( isSelected ? activeBackgroundColor : backgroundColor )
66
- . foregroundColor ( . white)
68
+ . background ( isSelected ? activeBackgroundColor : colorScheme == . dark ? Color ( UIColor . systemBackground . lighter ( by : 15 ) ! ) : . white )
69
+ . foregroundColor ( colorScheme == . dark && !isSelected ? . white : . black )
67
70
. cornerRadius ( 4 )
68
71
. overlay (
69
72
RoundedRectangle ( cornerRadius: 4 )
70
- . stroke ( isSelected ? activeBorderColor : borderColor, lineWidth: 1 )
73
+ . stroke ( isSelected ? activeBorderColor : colorScheme == . dark ? . gray . opacity ( 0.8 ) : borderColor, lineWidth: 1 )
71
74
)
72
75
}
73
76
}
74
77
}
75
78
76
79
struct NumberButtons : View {
80
+ @Environment ( \. colorScheme) var colorScheme
77
81
@Binding var selection : Int ;
78
82
79
83
let action : ( ) -> Void ;
@@ -91,12 +95,12 @@ struct NumberButtons: View {
91
95
Text ( option)
92
96
. frame ( maxWidth: . infinity)
93
97
. padding ( . vertical, 8 )
94
- . background ( isSelected ? activeBackgroundColor : backgroundColor )
95
- . foregroundColor ( . black)
98
+ . background ( isSelected ? activeBackgroundColor : colorScheme == . dark ? Color ( UIColor . systemBackground . lighter ( by : 15 ) ! ) : . white )
99
+ . foregroundColor ( colorScheme == . dark && !isSelected ? . white : . black)
96
100
. cornerRadius ( 4 )
97
101
. overlay (
98
102
RoundedRectangle ( cornerRadius: 4 )
99
- . stroke ( isSelected ? activeBorderColor : borderColor, lineWidth: 1 )
103
+ . stroke ( isSelected ? activeBorderColor : colorScheme == . dark ? . gray . opacity ( 0.8 ) : borderColor, lineWidth: 1 )
100
104
)
101
105
}
102
106
}
0 commit comments