Swiftpack.co - ppraveentr/MobileTheme as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ppraveentr.
ppraveentr/MobileTheme 1.2
AppTheming - Ablity to configure and maintaining SwiftUI elements's theme via simple JSON.
⭐️ 0
🕓 8 weeks ago
iOS macOS
.package(url: "https://github.com/ppraveentr/MobileTheme.git", from: "1.2")

Platform Language Swift Package Manager GitHub release (latest by date)

Build Status Quality Gate Status


A way to organize and manage style across the application dynamically (dark and light mode).


App's styles are defined thorugh a JSON file, which can loaded once app is lanched.

Sample - Theme.Json

    "version": "1.0",
    "colors": {
        "white": "#FFFFFF",
        "red": "#EE4B2B"
    "fonts": {
        "subHeader": { "weight": "subheadline" }
    "styles": {
        "TextRW": {
            "forgroundColor": {"light": "red", "dark": "white"},
            "font": "subHeader"

We can load the json file into Manager as:

   guard let themeModel = try? Data.contentOfFile("Theme.json") else { return }
   try? ThemesManager.loadThemeModel(themeModel)

Configure the SwiftUI Text style as below:

    Toggle("Color Scheme", isOn: $isLightMode)
      .theme(ColorSchemeValue(.title, dark: .headline))
    Text("Font as 'title' in LightMode and 'headline' in DarkMode")
      .theme(ColorSchemeValue(.title, dark: .headline))
    Text("'Red' in LightMode and 'White' in DarkMode")
    Text("'Blue' in LightMode and 'Red' in DarkMode")
      .theme(.foreground(color: .init(.blue, dark: .red)))



Stars: 0
Last commit: 8 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

8 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics