https://github.com/capturecontext/palette
Static Factory of Generic Colors
https://github.com/capturecontext/palette
color-palette colors generic generics ios linux osx palette pantone swift ui ux web
Last synced: about 2 months ago
JSON representation
Static Factory of Generic Colors
- Host: GitHub
- URL: https://github.com/capturecontext/palette
- Owner: CaptureContext
- License: mit
- Created: 2019-12-16T00:35:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-10-18T15:48:03.000Z (over 3 years ago)
- Last Synced: 2025-03-10T07:52:46.638Z (about 2 months ago)
- Topics: color-palette, colors, generic, generics, ios, linux, osx, palette, pantone, swift, ui, ux, web
- Language: Swift
- Size: 97.7 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
Platform agnostic static factory of [colors](https://github.com/MakeupStudio/GenericColor).
## Usage
```swift
import Palette
``````swift
let color1 = Color.pantone(.classicBlue()) // Pantone color of 2020
let color2 = Color.web(.skyBlue()) // WebColor SkyBlue
let color3 = Color.fuchsia // The same as magenta
let color4 = Color.iOS(.systemRed())
let color5 = Color.iOS(.systemRed(.light))
let color6 = Color.iOS(.systemRed(.dark))
```Compatibility with NSColor/UIColor:
```swift
func setTextColor(_ color: Color, to label: UILabel) {
label.textColor = .init(color)
}func getTextColor(from label: UILabel) -> Color {
label.textColor.genericRGB
}
```## Installation
Add the package to Your SwiftPM package dependencies:
```swift
.package(
url: "https://github.com/MakeupStudio/Palette.git",
from: "4.0.0-beta.3.0"
)
```then add `Palette` dependency to your target.
## Licence
MIT