An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

        








SwiftPM

Mac & Linux

Twitter: @maximkrouk

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