diff --git a/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/background_default.imageset/background_default@2x.png b/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/background_default.imageset/background_default@2x.png deleted file mode 100644 index 33e52bf..0000000 Binary files a/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/background_default.imageset/background_default@2x.png and /dev/null differ diff --git a/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/background_default.imageset/background_default@3x.png b/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/background_default.imageset/background_default@3x.png deleted file mode 100644 index 97b0ca5..0000000 Binary files a/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/background_default.imageset/background_default@3x.png and /dev/null differ diff --git a/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/background_default.imageset/Contents.json b/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/bg-texture.imageset/Contents.json similarity index 69% rename from Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/background_default.imageset/Contents.json rename to Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/bg-texture.imageset/Contents.json index 6443097..c1b3b4e 100644 --- a/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/background_default.imageset/Contents.json +++ b/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/bg-texture.imageset/Contents.json @@ -1,16 +1,17 @@ { "images" : [ { + "filename" : "bg-texture.png", "idiom" : "universal", "scale" : "1x" }, { - "filename" : "background_default@2x.png", + "filename" : "bg-texture@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "background_default@3x.png", + "filename" : "bg-texture@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/bg-texture.imageset/bg-texture.png b/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/bg-texture.imageset/bg-texture.png new file mode 100644 index 0000000..32e365d Binary files /dev/null and b/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/bg-texture.imageset/bg-texture.png differ diff --git a/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/bg-texture.imageset/bg-texture@2x.png b/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/bg-texture.imageset/bg-texture@2x.png new file mode 100644 index 0000000..21afc14 Binary files /dev/null and b/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/bg-texture.imageset/bg-texture@2x.png differ diff --git a/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/bg-texture.imageset/bg-texture@3x.png b/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/bg-texture.imageset/bg-texture@3x.png new file mode 100644 index 0000000..53e01cb Binary files /dev/null and b/Projects/DesignSystem/DesignCore/Resources/Images/Images.xcassets/bg-texture.imageset/bg-texture@3x.png differ diff --git a/Projects/DesignSystem/DesignCore/Sources/BackgroundTextureView.swift b/Projects/DesignSystem/DesignCore/Sources/BackgroundTextureView.swift index 33ba3f9..086766d 100644 --- a/Projects/DesignSystem/DesignCore/Sources/BackgroundTextureView.swift +++ b/Projects/DesignSystem/DesignCore/Sources/BackgroundTextureView.swift @@ -9,38 +9,62 @@ import SwiftUI public struct BackgroundTextureView: View { - public init() {} + public enum ColorType { + case `default` + case splashBrown + case splashGreen + case splashPurple + case splashPink + + var color: Color { + switch self { + case .default: return Color(hex: 0xF5F1EE) + case .splashBrown: return Color(hex: 0xE4DED7) + case .splashGreen: return Color(hex: 0xDFE7D1) + case .splashPurple: return Color(hex: 0xD7D7EA) + case .splashPink: return Color(hex: 0xECDAE3) + } + } + } + + let type: ColorType + + public init(_ type: ColorType) { + self.type = type + } public var body: some View { - DesignCore.Images.backgroundDefault.image - .resizable() - .frame( - width: Device.width, - height: Device.height - ) - .aspectRatio(contentMode: .fill) - .ignoresSafeArea() + ZStack { + type.color + DesignCore.Images.bgTexture.image + .resizable() + .frame( + width: Device.width, + height: Device.height + ) + .aspectRatio(contentMode: .fill) + } + .ignoresSafeArea() } } -fileprivate struct BackgroundTextureViewModifier: ViewModifier { - fileprivate func body(content: Content) -> some View { +private struct BackgroundTextureViewModifier: ViewModifier { + let colorType: BackgroundTextureView.ColorType + + func body(content: Content) -> some View { content .background { - DesignCore.Images.backgroundDefault.image - .resizable() - .frame( - width: Device.width, - height: Device.height - ) - .aspectRatio(contentMode: .fill) - .ignoresSafeArea() + BackgroundTextureView(colorType) } } } extension View { - public func textureBackground() -> some View { - modifier(BackgroundTextureViewModifier()) + public func textureBackground(_ type: BackgroundTextureView.ColorType) -> some View { + modifier(BackgroundTextureViewModifier(colorType: type)) } } + +#Preview { + BackgroundTextureView(.splashGreen) +} diff --git a/Projects/Features/DesignPreview/Sources/DesignBackgroundTextureView.swift b/Projects/Features/DesignPreview/Sources/DesignBackgroundTextureView.swift index d944f0e..6f482c1 100644 --- a/Projects/Features/DesignPreview/Sources/DesignBackgroundTextureView.swift +++ b/Projects/Features/DesignPreview/Sources/DesignBackgroundTextureView.swift @@ -15,7 +15,7 @@ struct DesignBackgroundTextureView: View { Text("This is Background 🎨") .typography(.semibold_20) } - .textureBackground() + .textureBackground(.splashPink) .navigationTitle("Texture Background") } }