A Swift package for working with Base16 and Base24 color themes, providing easy access to a wide variety of color schemes for your iOS, macOS, watchOS, and tvOS applications.
This package is a Swift API implementation for the TintedTheming/Schemes project, which provides a comprehensive collection of Base16 and Base24 color schemes.
- 🎨 Base16 Theme Support: Complete implementation of the Base16 color specification
- 🌈 Base24 Theme Support: Extended Base24 themes with additional colors
- 🔄 Theme Loading: Load themes from network or local cache
- 🎯 Semantic Colors: Easy access to semantic color mappings (background, foreground, etc.)
- 📱 Multi-Platform: Supports iOS 15+, macOS 12+, watchOS 8+, and tvOS 15+
- ⚡ SwiftUI Ready: Color extensions for seamless SwiftUI integration
Add TintedThemingSwift to your project using Xcode:
- In Xcode, go to File → Add Package Dependencies
- Enter the package URL:
https://github.com/aspauldingcode/TintedThemingSwift - Select the version and add to your target
Or add it to your Package.swift:
dependencies:[.package(url:"https://github.com/aspauldingcode/TintedThemingSwift", from:"1.0.0")]import TintedThemingSwift
// Use default themes
letdarkTheme=Base16Theme.defaultDark
letlightTheme=Base16Theme.defaultLight
// Access colors
letbackgroundColor= darkTheme.base00
letforegroundColor= darkTheme.base05
// Use semantic colors
letredColor= darkTheme.semanticColors["red"] // base08
letblueColor= darkTheme.semanticColors["blue"] // base0Dimport SwiftUI
import TintedThemingSwift
structContentView:View{lettheme=Base16Theme.defaultDark
varbody:someView{VStack{Text("Hello, World!").foregroundColor(Color(hex: theme.base05))Rectangle().fill(Color(hex: theme.base08)).frame(width:100, height:100)}.background(Color(hex: theme.base00))}}import TintedThemingSwift
letloader=TintedThemesLoader()Task{do{letthemes=tryawait loader.loadThemes()print("Loaded \(themes.count) themes")
// Find a specific theme
iflet monokai = themes.first(where:{ $0.name =="Monokai"}){
// Use the theme
}}catch{print("Failed to load themes: \(error)")}}The core theme structure with 16 standardized colors:
lettheme=Base16Theme.defaultDark
// Check theme variant
if theme.isDark {print("This is a dark theme")}
// Access all colors as an array
letallColors= theme.allColors // [base00, base01, ..., base0F]
// Get color by index
iflet color = theme.color(at:8){print("Color at index 8: \(color)") // base08
}Extended themes with 24 colors (Base16 + 8 additional):
letbase24Theme=Base24Theme(...)letbase16Version= base24Theme.asBase16Theme // Convert to Base16Load themes from the official repository:
letloader=TintedThemesLoader()
// Load all themes
letallThemes=tryawait loader.loadThemes()
// Load specific themes
letspecificThemes=tryawait loader.loadThemes(named:["Monokai","Solarized Dark"])
// Load only dark themes
letdarkThemes=tryawait loader.loadDarkThemes()
// Force refresh from network
tryawait loader.refreshThemes()Base16 themes follow a standardized 16-color palette:
- base00-03: Background colors (darkest to lightest)
- base04-07: Foreground colors (darkest to lightest)
- base08: Red
- base09: Orange
- base0A: Yellow
- base0B: Green
- base0C: Cyan
- base0D: Blue
- base0E: Purple
- base0F: Brown
- iOS 15.0+ / macOS 12.0+ / watchOS 8.0+ / tvOS 15.0+
- Swift 5.9+ / Xcode 15.0+
- Yams - YAML parsing for theme files
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE for details.
- TintedTheming/Schemes - The primary source of all color schemes
- Base16 - The original Base16 color scheme specification
📚 For additional documentation and examples, visit the Wiki
🔧 For GitHub Actions workflow documentation, see WORKFLOWS.md
Author:Alex Spaulding

