In the example SwiftUI Color is used but it also works with UIColor, NSColor and CGColor.
Init
let white = Color(hex: "#FFFFFF")
let red = Color(hex: "#FF0000")
let blue = Color(hex: "#0000FF")
let green = Color(hex: "#00FF00")
let yellow = Color(hex: "#FFFF00")
let black = Color(hex: "#000000")
Crayon
Usage
In the example SwiftUI
Color
is used but it also works withUIColor
,NSColor
andCGColor
.Init
isDark
&isLight
Check whether a color is dark or light
Calculate the contrast and check if there is good (≥ 7:1) contrast
Convert the color via
lighten
,darken
,saturate
,desaturate
,inverted
andnegative
You can also do basic calculations with colors
Install
SwiftPM
License
See LICENSE
Copyright © 2022 David Walter (www.davidwalter.at)