PFColorHash
  • March 11, 2024

Swift 4.0 SUPPORT!

Generate color based on the given string. Thanks to color-hash.

Usage


Basic

 

let colorHash = PFColorHash()

// in HSL, Hue ∈ [0, 360), Saturation ∈ [0, 1], Lightness ∈ [0, 1]
colorHash.hsl(‘Hello World’) // [ 225, 0.65, 0.35 ]

// in RGB, R, G, B ∈ [0, 255]
colorHash.rgb(‘Hello World’) // [ 134, 150, 196 ]

// in HEX
colorHash.hex(‘Hello World’) // ‘#8696c4’

Custom Hash Function / Lightness / Saturation

let colorHash = PFColorHash(hash: { (str: String) -> Int64 in
var hashValue: Int64 = 0
// Your Hash Function Here
return hashValue
})

let colorHash = PFColorHash(lightness: [0.35, 0.5, 0.65])

let colorHash = PFColorHash(saturation: [0.35, 0.5, 0.65])

let colorHash = PFColorHash(lightness: [0.35, 0.5, 0.65], saturation: [0.35, 0.5, 0.65])

GitHub


View Github

#color #colorpicker #colorpickerview #colors #material-colors
YOU MIGHT ALSO LIKE...
exyte

     

camerakit-ios

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service ...

HybridCamera

[video width="192" height="416" mp4="https://swiftgit.com/wp-content/uploads/2024/12/68747470733a2f2f7261776769742e636f6d2f7374796c656b69742f696d672f6d61737465722f7669645f6564697465645f325f326d622e676966.mp4"][/video]

TakeASelfie

An iOS framework that uses the front camera, detects your face and takes a selfie. This api opens the front ...

iOS-Depth-Sampler

Code examples of Depth APIs in iOS