# Generate NSColor / UIColor based on Swift String

*2015-12-13*

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

![](screen.gif)

I've published a Swift library [ColorHash], that generates `UIColor` and `NSColor` based on given string.

**[ngs/color-hash.swift]**

```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](https://github.com/zenozeng/color-hash).

<!--more-->

Install
-------

### CocoaPods

```rb
pod 'ColorHash'
```

### Carthage

```rb
github 'ngs/color-hash.swift'
```


[ngs/color-hash.swift]: https://github.com/ngs/color-hash.swift
[ColorHash]: https://github.com/ngs/color-hash.swift


