ارفع راسك فوق انته سوري حر ... :green_heart::green_heart:

Skip to content
Snippets Groups Projects
Commit 83b90200 authored by Mustafa Merza's avatar Mustafa Merza
Browse files

- Added using color style in custom colors modifiers and in SwiftUI views.

parent 05440954
Branches
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ import SwiftUI ...@@ -10,7 +10,7 @@ import SwiftUI
struct CustomColorModifier: ViewModifier { struct CustomColorModifier: ViewModifier {
var color: Color var color: ColorStyle
var place: ColorPlace var place: ColorPlace
func body(content: Content) -> some View { func body(content: Content) -> some View {
...@@ -19,23 +19,23 @@ struct CustomColorModifier: ViewModifier { ...@@ -19,23 +19,23 @@ struct CustomColorModifier: ViewModifier {
case .background: case .background:
content content
.background(color) .background(color.color)
case .foreground: case .foreground:
content content
.foregroundStyle(color) .foregroundStyle(color.color)
} }
} }
} }
extension View { extension View {
func customForeground(_ color: Color) -> some View { func customForeground(_ color: ColorStyle) -> some View {
ModifiedContent(content: self, modifier: CustomColorModifier(color: color, place: .foreground)) ModifiedContent(content: self, modifier: CustomColorModifier(color: color, place: .foreground))
} }
func customBackground(_ color: Color) -> some View { func customBackground(_ color: ColorStyle) -> some View {
ModifiedContent(content: self, modifier: CustomColorModifier(color: color, place: .background)) ModifiedContent(content: self, modifier: CustomColorModifier(color: color, place: .background))
} }
} }
......
...@@ -22,6 +22,7 @@ struct CustomMenuPicker<Item: CustomMenuPickerItem, Label: View>: View { ...@@ -22,6 +22,7 @@ struct CustomMenuPicker<Item: CustomMenuPickerItem, Label: View>: View {
ForEach(items) { item in ForEach(items) { item in
Text(item.displayedName) Text(item.displayedName)
.customForeground(.gray600)
.tag(item) .tag(item)
} }
} }
......
...@@ -31,7 +31,7 @@ struct CustomPicker<Item: CustomMenuPickerItem>: View { ...@@ -31,7 +31,7 @@ struct CustomPicker<Item: CustomMenuPickerItem>: View {
HStack { HStack {
Text(item.displayedName) Text(item.displayedName)
.customForeground(.mainText) .customForeground(.gray600)
Spacer() Spacer()
...@@ -41,7 +41,7 @@ struct CustomPicker<Item: CustomMenuPickerItem>: View { ...@@ -41,7 +41,7 @@ struct CustomPicker<Item: CustomMenuPickerItem>: View {
.resizable() .resizable()
.aspectRatio(contentMode: .fit) .aspectRatio(contentMode: .fit)
.frame(width: 12, height: 12) .frame(width: 12, height: 12)
.customForeground(.mainBlue) .customForeground(.primary)
} }
} }
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
......
...@@ -26,13 +26,13 @@ struct PrimaryButton: View { ...@@ -26,13 +26,13 @@ struct PrimaryButton: View {
.frame(height: 54) .frame(height: 54)
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
}) })
.customBackground(.buttonsBlue) .customBackground(.primary)
.customCornerRadius(12) .customCornerRadius(12)
} }
private var titleView: some View { private var titleView: some View {
Text(title) Text(title)
.customForeground(.mainText) .customForeground(.gray0)
} }
} }
......
...@@ -24,7 +24,7 @@ struct MainView<ViewModel: MainViewModel, Content: View>: View { ...@@ -24,7 +24,7 @@ struct MainView<ViewModel: MainViewModel, Content: View>: View {
content() content()
.frame(maxWidth: .infinity, maxHeight: .infinity) .frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.mainBackground) .customBackground(.base)
.onAppear { .onAppear {
viewModel.onAppear() viewModel.onAppear()
} }
......
...@@ -45,16 +45,17 @@ struct SettingButton: View { ...@@ -45,16 +45,17 @@ struct SettingButton: View {
.resizable() .resizable()
.aspectRatio(contentMode: .fit) .aspectRatio(contentMode: .fit)
.frame(width: 20, height: 20) .frame(width: 20, height: 20)
.customForeground(.gray600)
} }
private var titleView: some View { private var titleView: some View {
Text(title) Text(title)
.customForeground(.mainText) .customForeground(.gray600)
} }
private var valueView: some View { private var valueView: some View {
Text(value) Text(value)
.customForeground(.mainText) .customForeground(.gray350)
} }
private var changeButton: some View { private var changeButton: some View {
...@@ -63,7 +64,7 @@ struct SettingButton: View { ...@@ -63,7 +64,7 @@ struct SettingButton: View {
}, label: { }, label: {
Text(String.change.localized) Text(String.change.localized)
.customForeground(.mainText) .customForeground(.gray600)
}) })
} }
} }
......
...@@ -39,7 +39,7 @@ extension SettingSheetView { ...@@ -39,7 +39,7 @@ extension SettingSheetView {
private var titleView: some View { private var titleView: some View {
Text(title) Text(title)
.customForeground(.mainText) .customForeground(.gray600)
} }
private var picker: some View { private var picker: some View {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment