ColorWithHSL 1.0.6

ColorWithHSL 1.0.6

测试已测试
语言 SwiftSwift
许可 MIT
发布最后发布2016年4月
SPM支持 SPM

Gabriel Massana 维护。



  • 作者
  • Gabriel Massana

ColorWithHSL-iOS

这是什么?

Swift 扩展,用于将 HSL 颜色值转换为 UIColor 对象。

HSL 代表色调、饱和度和亮度,也常被称为 HLS。

公式来自 维基百科

安装

Podfile

platform :ios, '8.0'
use_frameworks!

pod 'ColorWithHSL', '~> 0.0'

然后,运行以下命令

$ pod install

老式方法

/ColorWithHSL-iOS 文件夹拖入您的项目中。就完成了。

Swift 示例

        let black: UIColor = UIColor.colorWithHSL(hue: 0.0, saturation: 0.0, lightness: 0.0)
        let white: UIColor = UIColor.colorWithHSL(hue: 0.0, saturation: 0.0, lightness: 1.0)
        let red: UIColor = UIColor.colorWithHSL(hue: 0.0, saturation: 1.0, lightness: 0.5)
        let green: UIColor = UIColor.colorWithHSL(hue: 120.0, saturation: 1.0, lightness: 0.5)
        let blue: UIColor = UIColor.colorWithHSL(hue: 240.0, saturation: 1.0, lightness: 0.5)

Objective-C 示例

#import "ColorWithHSL-Swift.h"

...
    UIColor *black = [UIColor hsl_colorWithHue:0.0 saturation:0.0 lightness:0.0];
    UIColor *white = [UIColor hsl_colorWithHue:0.0 saturation:0.0 lightness:1.0];
    UIColor *red = [UIColor hsl_colorWithHue:0.0 saturation:1.0 lightness:0.5];
    UIColor *green = [UIColor hsl_colorWithHue:120.0 saturation:1.0 lightness:0.5];
    UIColor *blue = [UIColor hsl_colorWithHue:240.0 saturation:1.0 lightness:0.5];

许可

ColorWithHSL-iOS 采用 MIT 许可发布。请参阅名为 LICENSE 的文件。

版本

$ git tag -a 1.0.0 -m 'Version 1.0.0'

$ git push --tags

作者

Gabriel Massana

发现了一个问题吗?

如果您遇到特定于 ColorWithHSL-iOS 的问题、有功能请求或想要发表评论,请在此处 打开新问题