Swift的隨機顏色生成器:RandomColorSwift
randomColor.js的一個Swift移植版。這個庫可用于在iOS or OSX中生成誘人的隨機顏色。
查看示例:demo and site。
// 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)
本文由用戶 ne3g 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!