Generate NSColor / UIColor based on Swift String

 日本語

I’ve published a Swift library ColorHash, that generates UIColor and NSColor based on given string.

ngs/color-hash.swift

import ColorHash
let str = "こんにちは、世界"
let saturation = CGFloat(0.30)
let lightness = CGFloat(0.70)
ColorHash(str, [saturation], [lightness]).color

This is a Swift port of a JavaScript library Color Hash.

Install

CocoaPods

pod 'ColorHash'

Carthage

github 'ngs/color-hash.swift'
comments powered by Disqus