https://github.com/hsluv/hsluv-swift
Swift implementation of HSLuv (revision 4)
https://github.com/hsluv/hsluv-swift
Last synced: about 1 year ago
JSON representation
Swift implementation of HSLuv (revision 4)
- Host: GitHub
- URL: https://github.com/hsluv/hsluv-swift
- Owner: hsluv
- License: other
- Created: 2015-06-15T23:24:07.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2025-03-11T07:10:50.000Z (over 1 year ago)
- Last Synced: 2025-04-12T10:05:51.287Z (about 1 year ago)
- Language: Swift
- Homepage:
- Size: 1.56 MB
- Stars: 38
- Watchers: 9
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HSLuvSwift
[](https://swift.org/package-manager/)
[](https://cocoapods.org/pods/HSLuvSwift)
[](https://github.com/Carthage/Carthage)
[](https://travis-ci.org/hsluv/hsluv-swift)
[](LICENSE)
Swift port of [HSLuv](http://www.hsluv.org) (revision 4), courtesy
of [Clay Smith](https://github.com/stphnclysmth)
[Explanation, demo, ports etc.](http://www.hsluv.org)
## USAGE
This framework adds a single initializer on the OS-specific color class to create a color from HSLuv parameters. The initializer takes the same parameters on both macOS and iOS.
```swift
// macOS
let color = NSColor(hue: 360.0, saturation: 100.0, lightness: 100.0, alpha: 1.0)
// iOS
let color = UIColor(hue: 360.0, saturation: 100.0, lightness: 100.0, alpha: 1.0)
```
## INSTALL
This project is compatible with Swift Package Manager, CocoaPods and Carthage. (These instructions assume that your chosen method is already installed.)
#### Swift Package Manager
As of version 2.1.0, you can use the Swift Package Manager as integration method.
If you want to use the Swift Package Manager as integration method, either use Xcode to add the package dependency or add the following dependency to your Package.swift:
```swift
.package(url: "https://github.com/hsluv/hsluv-swift.git", from: "2.1.0"),
```
### CocoaPods
Add `pod 'HSLuvSwift'` to your target. Since this is a Swift dynamic framework, you must also tell CocoaPods to `use_frameworks!` instead of static libraries.
```ruby
platform :ios, '10.0' # or, :osx, '10.10'
use_frameworks!
target 'YourProject' do
pod 'HSLuvSwift', '~> 2.0.0'
end
```
### Carthage
Add `github "hsluv/hsluv-swift" ~> 2.0.0` to your Cartfile and run `carthage bootstrap`. This builds frameworks for Mac and iOS targets.
```sh
> echo 'github "hsluv/hsluv-swift" ~> 2.0.0' >> Cartfile
> carthage bootstrap
```
## TODO
* Finish HPLuv implementation
* Improve tests and add continuous integration testing
* Add usage documentation
## License
See [License](LICENSE)