TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Oct 2015 |
SPMSupports SPM | ✗ |
Maintained by ikemai.
ImColorAdjustmenter is the library which can play with the numerical value of the color.
To run the example project, clone the repo, and run pod install
from the Example directory first.
ImColorAdjustmenter is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ImColorAdjustmenter"
let color = UIColor(hex: 0xB7EAE7)
let adjustmentColor = color.colorWithHBSComponent(hue: hueValue, brightness: brightnessValue, saturation: saturationValue)
adjustmentColorView.backgroundColor = adjustmentColor
let adjustmentColor = color.colorWithHBSComponent(hue: hueValue, brightness: brightnessValue, saturation: saturationValue)
adjustmentColorView.backgroundColor = adjustmentColor
if let hbs = adjustmentColor?.colorHBS() {
print("Hue = \(hbs.hue)")
print("Bridhtness = \(hbs.brightness)")
print("Saturation = \(hbs.saturation)")
}
let adjustmentColor = color.colorWithRGBComponent(r: rValue, g: gValue, b: bValue)
targetView.backgroundColor = adjustmentColor
if let rbg = adjustmentColor?.colorRGB() {
print("Red = \(rbg.r)")
print("Green = \(rbg.g)")
print("Blue = \(rbg.b)")
}
let colors: [CGColor] = [UIColor.whiteColor().CGColor, UIColor.redColor().CGColor]
let locations: [CGFloat] = [0.0, 1.0]
targetView.layerVerticallyGradient(colors: colors, locations: locations)
public convenience init(hex: Int, alpha: CGFloat = 1)
public func colorWithHBSComponent(hue hue: CGFloat, brightness: CGFloat, saturation: CGFloat) -> UIColor?
public func colorHBS() -> ImColorAdjustmenter.HBSProperties?
public func colorWithRGBComponent(r r: CGFloat, g: CGFloat, b: CGFloat) -> UIColor?
public func colorRGB() -> ImColorAdjustmenter.RGBProperties?
public func layerVerticallyGradient(colors colors: [AnyObject], locations: [CGFloat])
public struct HBSProperties {
public var hue: CGFloat = 0
public var brightness: CGFloat = 0
public var saturation: CGFloat = 0
public var alpha: CGFloat = 1
}
public struct RGBProperties {
public var r: CGFloat = 0
public var g: CGFloat = 0
public var b: CGFloat = 0
public var alpha: CGFloat = 1
}
ikemai
ImColorAdjustmenter is available under the MIT license. See the LICENSE file for more info.