Skip to content

sentryco/HybridColor

Repository files navigation

Tests

๐ŸŒ“ 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

dependencies: [
    .package(url: "https://github.com/sentryco/HybridColor.git", branch: "main")
]

Usage

import SwiftUI
import HybridColor

#Preview {
    struct ContentView: View {
        var body: some View {
            Text("Hello, world!")
                .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

About

๐ŸŒ“ Add dark and light mode support to swiftUI Color

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages