Entries tagged with coccoa

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.

Read On 

Copy UIColor / NSColor initializer code from Sketch app

I’ve published Copy Swift Code, a Sketch app plugin for generating UIColor and NSColor initializer Swift code from fill color of selected layers.

ngs/sketchplugin-swift-color

Read On