Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sentryco/hybridcolor
🌓 Add dark and light mode support to swiftUI Color
https://github.com/sentryco/hybridcolor
Last synced: about 1 month ago
JSON representation
🌓 Add dark and light mode support to swiftUI Color
- Host: GitHub
- URL: https://github.com/sentryco/hybridcolor
- Owner: sentryco
- License: mit
- Created: 2024-03-07T07:02:55.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-12-26T14:13:59.000Z (about 2 months ago)
- Last Synced: 2024-12-26T15:22:06.356Z (about 2 months ago)
- Language: Swift
- Size: 37.1 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/sentryco/HybridColor/actions/workflows/Tests.yml)
[](https://codebeat.co/projects/github-com-sentryco-hybridcolor-main)# 🌓 HybridColor
HybridColor is a Swift library designed for both macOS and iOS. It offers a seamless way to create SwiftUI colors that adapt to light and dark modes, enhancing the user interface experience across different environments.
## Requirements
- macOS v14 and later
- iOS 17 and later
- Swift 5.9 and later## Installation
```swift
dependencies: [
.package(url: "https://github.com/sentryco/HybridColor.git", branch: "main")
]
```## Usage
```swift
import SwiftUI
import HybridColor#Preview {
struct ContentView: View {
var body: some View {
Text("Hello, world!")
.foregroundColor(.whiteOrBlack) // white in dark-mode, black in light-mode
.padding()
.background(.init(light: .white, dark: .black))
}
}
return Group {
ContentView()
.preferredColorScheme(.light)
ContentView()
.preferredColorScheme(.dark)
}
}
```## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
## License
[MIT](https://choosealicense.com/licenses/mit/)
## Todo:
- Add systemGreen, systemPink, etc