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: 1 day 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 (9 months ago)
- Default Branch: main
- Last Pushed: 2024-11-06T11:54:13.000Z (11 days ago)
- Last Synced: 2024-11-06T12:42:57.219Z (11 days ago)
- Language: Swift
- Size: 31.3 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
[![Tests](https://github.com/sentryco/HybridColor/actions/workflows/Tests.yml/badge.svg)](https://github.com/sentryco/HybridColor/actions/workflows/Tests.yml)
[![codebeat badge](https://codebeat.co/badges/127fa394-9f2f-4910-ae8a-d9ddf5638e62)](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