RandomColorSwift 是从 randomColor.js 移植过来的 Swift 颜色生成器,非常迷人。
代码示例:
import RandomColor // Returns a UIColor or NSColor object for an attractive color let color = randomColor() // Returns an array of ten green colors let greenColors = randomColorsCount(10, hue: .Green) // Returns a color for light blue let lightBlurColor = randomColor(hue: .Blue, luminosity: .Light) // Returns a color for a 'truly random' color let randomColor = randomColor(hue: .Random, luminosity: .Random) // Returns an array of ten dark pink colors let darkPinkColors = randomColorsCount(10, hue: .Pink, luminosity: .Dark) // Returns an array of twenty colors at hue of 120 let colors = randomColorsCount(20, hue: .Value(120), luminosity: .Random)