Swift的随机颜色生成器:RandomColorSwift

ne3g 5年前

randomColor.js的一个Swift移植版。这个库可用于在iOS or OSX中生成诱人的随机颜色。

查看示例:demo and site

Demo

// 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)

项目主页:http://www.open-open.com/lib/view/home/1422264439492