Skip to content

Commit 7f20f75

Browse files
remove colorScheme from SUButton and README
1 parent d0d059e commit 7f20f75

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ All colors from the config can be used within the app. For example:
123123
view.backgroundColor = UniversalColor.background.uiColor
124124

125125
// in SwiftUI
126-
@Environment(\.colorScheme) var colorScheme
127-
UniversalColor.background.color(for: colorScheme)
126+
UniversalColor.background.color
128127
```
129128

130129
If you want to use additional colors that are not included in the config, you can extend `UniversalColor`:

Sources/ComponentsKit/Components/Button/SUButton.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ public struct SUButton: View {
5252
private struct CustomButtonStyle: SwiftUI.ButtonStyle {
5353
let model: ButtonVM
5454

55-
@Environment(\.colorScheme) var colorScheme
56-
5755
func makeBody(configuration: Configuration) -> some View {
5856
configuration.label
5957
.font(self.model.preferredFont.font)
@@ -63,9 +61,7 @@ private struct CustomButtonStyle: SwiftUI.ButtonStyle {
6361
.frame(maxWidth: self.model.width)
6462
.frame(height: self.model.height)
6563
.foregroundStyle(self.model.foregroundColor.color)
66-
.background(
67-
self.model.backgroundColor?.color ?? Color.clear
68-
)
64+
.background(self.model.backgroundColor?.color ?? .clear)
6965
.clipShape(
7066
RoundedRectangle(
7167
cornerRadius: self.model.cornerRadius.value()

0 commit comments

Comments
 (0)