Platform agnostic static factory of colors.
import Palette
let color1 = Color<RGB>.pantone(.classicBlue()) // Pantone color of 2020
let color2 = Color<RGB>.web(.skyBlue()) // WebColor SkyBlue
let color3 = Color<RGB>.fuchsia // The same as magenta
let color4 = Color<RGB>.iOS(.systemRed())
let color5 = Color<RGB>.iOS(.systemRed(.light))
let color6 = 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