Platform agnostic static factory of colors.
import Paletteletcolor1= Color<RGB>.pantone(.classicBlue()) // Pantone color of 2020
letcolor2= Color<RGB>.web(.skyBlue()) // WebColor SkyBlue
letcolor3= Color<RGB>.fuchsia // The same as magenta
letcolor4= Color<RGB>.iOS(.systemRed())letcolor5= Color<RGB>.iOS(.systemRed(.light))letcolor6= Color<RGB>.iOS(.systemRed(.dark))Compatibility with NSColor/UIColor:
func setTextColor(_ color:Color<RGB>, to label:UILabel){
label.textColor =.init(color)}func getTextColor(from label:UILabel)->Color<RGB>{
label.textColor.genericRGB
}Add the package to Your SwiftPM package dependencies:
.package(
url:"https://github.com/MakeupStudio/Palette.git", from:"4.0.0-beta.3.0")then add Palette dependency to your target.
MIT
