diff --git a/PlatformUI/PlatformUI/DesignSystem/Theme/SampleTheme.json b/PlatformUI/PlatformUI/DesignSystem/Theme/SampleTheme.json index e8f47d3e6..427e66c07 100644 --- a/PlatformUI/PlatformUI/DesignSystem/Theme/SampleTheme.json +++ b/PlatformUI/PlatformUI/DesignSystem/Theme/SampleTheme.json @@ -1,4 +1,5 @@ { + "id": "sample", "themeColor": { "layer": { "lowest": "#000000", diff --git a/PlatformUI/PlatformUI/DesignSystem/Theme/ThemeConfig.swift b/PlatformUI/PlatformUI/DesignSystem/Theme/ThemeConfig.swift index bf3a338c6..e258f84fd 100644 --- a/PlatformUI/PlatformUI/DesignSystem/Theme/ThemeConfig.swift +++ b/PlatformUI/PlatformUI/DesignSystem/Theme/ThemeConfig.swift @@ -29,6 +29,7 @@ public final class ThemeSettings: ObservableObject, SingletonProtocol { // MARK: - ThemeConfig public struct ThemeConfig: Codable, Equatable { + public let id: String public let themeColor: ThemeColor public let themeFont: ThemeFont } diff --git a/PlatformUI/PlatformUI/DesignSystem/Theme/ThemeViewModifiers.swift b/PlatformUI/PlatformUI/DesignSystem/Theme/ThemeViewModifiers.swift index e28ea543b..d3f21ceda 100644 --- a/PlatformUI/PlatformUI/DesignSystem/Theme/ThemeViewModifiers.swift +++ b/PlatformUI/PlatformUI/DesignSystem/Theme/ThemeViewModifiers.swift @@ -75,6 +75,14 @@ private struct GradientColorModifier: ViewModifier { } public extension Image { + /// iniitalizes an image that supports app themes + /// - Parameters: + /// - themedImageBaseName: the base image name. e.g. if the app supports 3 themes and the corresponding themed image names are "circle_light" "circle_dark" and "circle_classic_dark" then your base name is "circle" + /// - bundle: the bundle + init(themedImageBaseName: String, bundle: Bundle, themeSettings: ThemeSettings = ThemeSettings.shared) { + self.init(themedImageBaseName + "_" + "\(themeSettings.themeConfig.id)", bundle: bundle) + } + func templateColor(_ foreground: ThemeColor.SemanticColor?) -> some View { if let foreground = foreground { return AnyView(self.renderingMode(.template).themeColor(foreground: foreground)) diff --git a/dydx/dydxViews/dydxViews/Media.xcassets/texture.imageset/Contents.json b/dydx/dydxViews/dydxViews/Media.xcassets/texture_classic_dark.imageset/Contents.json similarity index 77% rename from dydx/dydxViews/dydxViews/Media.xcassets/texture.imageset/Contents.json rename to dydx/dydxViews/dydxViews/Media.xcassets/texture_classic_dark.imageset/Contents.json index 1920a98ad..6442b86c8 100644 --- a/dydx/dydxViews/dydxViews/Media.xcassets/texture.imageset/Contents.json +++ b/dydx/dydxViews/dydxViews/Media.xcassets/texture_classic_dark.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "texture.pdf", + "filename" : "texture 1.pdf", "idiom" : "universal" } ], diff --git a/dydx/dydxViews/dydxViews/Media.xcassets/texture.imageset/texture.pdf b/dydx/dydxViews/dydxViews/Media.xcassets/texture_classic_dark.imageset/texture 1.pdf similarity index 100% rename from dydx/dydxViews/dydxViews/Media.xcassets/texture.imageset/texture.pdf rename to dydx/dydxViews/dydxViews/Media.xcassets/texture_classic_dark.imageset/texture 1.pdf diff --git a/dydx/dydxViews/dydxViews/Media.xcassets/texture_dark.imageset/Contents.json b/dydx/dydxViews/dydxViews/Media.xcassets/texture_dark.imageset/Contents.json new file mode 100644 index 000000000..6442b86c8 --- /dev/null +++ b/dydx/dydxViews/dydxViews/Media.xcassets/texture_dark.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "texture 1.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/dydx/dydxViews/dydxViews/Media.xcassets/texture_dark.imageset/texture 1.pdf b/dydx/dydxViews/dydxViews/Media.xcassets/texture_dark.imageset/texture 1.pdf new file mode 100644 index 000000000..e8b4ebc03 Binary files /dev/null and b/dydx/dydxViews/dydxViews/Media.xcassets/texture_dark.imageset/texture 1.pdf differ diff --git a/dydx/dydxViews/dydxViews/Media.xcassets/texture_light.imageset/Contents.json b/dydx/dydxViews/dydxViews/Media.xcassets/texture_light.imageset/Contents.json new file mode 100644 index 000000000..f29960198 --- /dev/null +++ b/dydx/dydxViews/dydxViews/Media.xcassets/texture_light.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "texture_light.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/dydx/dydxViews/dydxViews/Media.xcassets/texture_light.imageset/texture_light.pdf b/dydx/dydxViews/dydxViews/Media.xcassets/texture_light.imageset/texture_light.pdf new file mode 100644 index 000000000..8e41e2e93 Binary files /dev/null and b/dydx/dydxViews/dydxViews/Media.xcassets/texture_light.imageset/texture_light.pdf differ diff --git a/dydx/dydxViews/dydxViews/Themes/ThemeClassicDark.json b/dydx/dydxViews/dydxViews/Themes/ThemeClassicDark.json index 278101e3e..cf87b21c3 100644 --- a/dydx/dydxViews/dydxViews/Themes/ThemeClassicDark.json +++ b/dydx/dydxViews/dydxViews/Themes/ThemeClassicDark.json @@ -1,4 +1,5 @@ { + "id": "classic_dark", "themeColor": { "color": { "text_primary": "#FAFAFD", diff --git a/dydx/dydxViews/dydxViews/Themes/ThemeDark.json b/dydx/dydxViews/dydxViews/Themes/ThemeDark.json index 612cbb84b..f96bf95cc 100644 --- a/dydx/dydxViews/dydxViews/Themes/ThemeDark.json +++ b/dydx/dydxViews/dydxViews/Themes/ThemeDark.json @@ -1,4 +1,5 @@ { + "id": "dark", "themeColor": { "color": { "text_primary": "#FAFAFA", diff --git a/dydx/dydxViews/dydxViews/Themes/ThemeLight.json b/dydx/dydxViews/dydxViews/Themes/ThemeLight.json index a44ead89a..144129c5c 100644 --- a/dydx/dydxViews/dydxViews/Themes/ThemeLight.json +++ b/dydx/dydxViews/dydxViews/Themes/ThemeLight.json @@ -1,4 +1,5 @@ { + "id": "light", "themeColor": { "color": { "text_primary": "#181818", diff --git a/dydx/dydxViews/dydxViews/_v4/Profile/TradingRewards/Components/dydxRewardsLaunchIncentivesView.swift b/dydx/dydxViews/dydxViews/_v4/Profile/TradingRewards/Components/dydxRewardsLaunchIncentivesView.swift index bb2df2ec1..b9dd449e5 100644 --- a/dydx/dydxViews/dydxViews/_v4/Profile/TradingRewards/Components/dydxRewardsLaunchIncentivesView.swift +++ b/dydx/dydxViews/dydxViews/_v4/Profile/TradingRewards/Components/dydxRewardsLaunchIncentivesView.swift @@ -72,7 +72,7 @@ public class dydxRewardsLaunchIncentivesViewModel: PlatformViewModel { } .padding(.all, 16) .background { - Image("texture", bundle: .dydxView) + Image(themedImageBaseName: "texture", bundle: .dydxView) .resizable() .scaledToFill() }