@@ -4,17 +4,14 @@ A Swift package for working with Base16 and Base24 color themes, providing easy
44
55This package is a Swift API implementation for the [ TintedTheming/Schemes] ( https://github.com/tinted-theming/schemes ) project, which provides a comprehensive collection of Base16 and Base24 color schemes.
66
7- ## 📖 Documentation
8-
9- For complete documentation, API reference, usage examples, and guides, please visit the ** [ Wiki] ( ../../wiki ) ** .
10-
117## ✨ Features
128
13- - 🎨 Base16 & Base24 theme support
14- - 🔄 Network & local cache theme loading
15- - 🎯 Semantic color mappings
16- - 📱 Multi-platform (iOS 15+, macOS 12+, watchOS 8+, tvOS 15+)
17- - ⚡ SwiftUI, UIKit, and AppKit integration
9+ - 🎨 ** Base16 Theme Support** : Complete implementation of the Base16 color specification
10+ - 🌈 ** Base24 Theme Support** : Extended Base24 themes with additional colors
11+ - 🔄 ** Theme Loading** : Load themes from network or local cache
12+ - 🎯 ** Semantic Colors** : Easy access to semantic color mappings (background, foreground, etc.)
13+ - 📱 ** Multi-Platform** : Supports iOS 15+, macOS 12+, watchOS 8+, and tvOS 15+
14+ - ⚡ ** SwiftUI Ready** : Color extensions for seamless SwiftUI integration
1815
1916## Installation
2017
@@ -36,29 +33,145 @@ dependencies: [
3633
3734## 🚀 Quick Start
3835
36+ ### Basic Theme Usage
37+
38+ ``` swift
39+ import TintedThemingSwift
40+
41+ // Use default themes
42+ let darkTheme = Base16Theme.defaultDark
43+ let lightTheme = Base16Theme.defaultLight
44+
45+ // Access colors
46+ let backgroundColor = darkTheme.base00
47+ let foregroundColor = darkTheme.base05
48+
49+ // Use semantic colors
50+ let redColor = darkTheme.semanticColors [" red" ] // base08
51+ let blueColor = darkTheme.semanticColors [" blue" ] // base0D
52+ ```
53+
54+ ### SwiftUI Integration
55+
56+ ``` swift
57+ import SwiftUI
58+ import TintedThemingSwift
59+
60+ struct ContentView : View {
61+ let theme = Base16Theme.defaultDark
62+
63+ var body: some View {
64+ VStack {
65+ Text (" Hello, World!" )
66+ .foregroundColor (Color (hex : theme.base05 ))
67+
68+ Rectangle ()
69+ .fill (Color (hex : theme.base08 ))
70+ .frame (width : 100 , height : 100 )
71+ }
72+ .background (Color (hex : theme.base00 ))
73+ }
74+ }
75+ ```
76+
77+ ### Loading Themes from Network
78+
3979``` swift
4080import TintedThemingSwift
4181
42- // Use a default theme
82+ let loader = TintedThemesLoader ()
83+
84+ Task {
85+ do {
86+ let themes = try await loader.loadThemes ()
87+ print (" Loaded \( themes.count ) themes" )
88+
89+ // Find a specific theme
90+ if let monokai = themes.first (where : { $0 .name == " Monokai" }) {
91+ // Use the theme
92+ }
93+ } catch {
94+ print (" Failed to load themes: \( error ) " )
95+ }
96+ }
97+ ```
98+
99+ ## API Overview
100+
101+ ### Base16Theme
102+
103+ The core theme structure with 16 standardized colors:
104+
105+ ``` swift
43106let theme = Base16Theme.defaultDark
44107
45- // Load themes from network
108+ // Check theme variant
109+ if theme.isDark {
110+ print (" This is a dark theme" )
111+ }
112+
113+ // Access all colors as an array
114+ let allColors = theme.allColors // [base00, base01, ..., base0F]
115+
116+ // Get color by index
117+ if let color = theme.color (at : 8 ) {
118+ print (" Color at index 8: \( color ) " ) // base08
119+ }
120+ ```
121+
122+ ### Base24Theme
123+
124+ Extended themes with 24 colors (Base16 + 8 additional):
125+
126+ ``` swift
127+ let base24Theme = Base24Theme (... )
128+ let base16Version = base24Theme.asBase16Theme // Convert to Base16
129+ ```
130+
131+ ### TintedThemesLoader
132+
133+ Load themes from the official repository:
134+
135+ ``` swift
46136let loader = TintedThemesLoader ()
47- let themes = try await loader.loadThemes ()
48137
49- // SwiftUI integration
50- Text (" Hello, World!" )
51- .foregroundColor (Color (hex : theme.base05 ))
52- .background (Color (hex : theme.base00 ))
138+ // Load all themes
139+ let allThemes = try await loader.loadThemes ()
140+
141+ // Load specific themes
142+ let specificThemes = try await loader.loadThemes (named : [" Monokai" , " Solarized Dark" ])
143+
144+ // Load only dark themes
145+ let darkThemes = try await loader.loadDarkThemes ()
146+
147+ // Force refresh from network
148+ try await loader.refreshThemes ()
53149```
54150
55- For detailed usage examples, API documentation, and integration guides, see the ** [ Wiki] ( ../../wiki ) ** .
151+ ## Base16 Color Specification
152+
153+ Base16 themes follow a standardized 16-color palette:
154+
155+ - ** base00-03** : Background colors (darkest to lightest)
156+ - ** base04-07** : Foreground colors (darkest to lightest)
157+ - ** base08** : Red
158+ - ** base09** : Orange
159+ - ** base0A** : Yellow
160+ - ** base0B** : Green
161+ - ** base0C** : Cyan
162+ - ** base0D** : Blue
163+ - ** base0E** : Purple
164+ - ** base0F** : Brown
56165
57166## Requirements
58167
59168- iOS 15.0+ / macOS 12.0+ / watchOS 8.0+ / tvOS 15.0+
60169- Swift 5.9+ / Xcode 15.0+
61170
171+ ## Dependencies
172+
173+ - [ Yams] ( https://github.com/jpsim/Yams ) - YAML parsing for theme files
174+
62175## Contributing
63176
64177Contributions are welcome! Please feel free to submit a Pull Request.
@@ -67,8 +180,15 @@ Contributions are welcome! Please feel free to submit a Pull Request.
67180
68181MIT License - see [ LICENSE] ( LICENSE ) for details.
69182
183+ ## Acknowledgments
184+
185+ - [ TintedTheming/Schemes] ( https://github.com/tinted-theming/schemes ) - The primary source of all color schemes
186+ - [ Base16] ( https://github.com/chriskempson/base16 ) - The original Base16 color scheme specification
187+
70188---
71189
72- ** 📚 For complete documentation, visit the [ Wiki] ( ../../wiki ) **
190+ ** 📚 For additional documentation and examples, visit the [ Wiki] ( ../../wiki ) **
191+
192+ ** 🔧 For GitHub Actions workflow documentation, see [ WORKFLOWS.md] ( WORKFLOWS.md ) **
73193
74- ** Author:** [ Alex Spaulding] ( https://github.com/aspauldingcode ) | ** Schemes: ** [ TintedTheming/Schemes ] ( https://github.com/tinted-theming/schemes )
194+ ** Author:** [ Alex Spaulding] ( https://github.com/aspauldingcode )
0 commit comments