Swiftpack.co - richardpiazza/SwiftColor as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by richardpiazza.
richardpiazza/SwiftColor 0.2.0
A platform agnostic representation of Color.
⭐️ 0
🕓 1 year ago
.package(url: "https://github.com/richardpiazza/SwiftColor.git", from: "0.2.0")

SwiftColor

A platform agnostic representation of Color.

Twitter: @richardpiazza

Usage

SwiftColor is distributed using the Swift Package Manager. To install it into a project, add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/richardpiazza/SwiftColor.git", .upToNextMajor(from: "0.2.0"))
    ],
    ...
)

Then import the SwiftColor packages wherever you'd like to use it:

import SwiftColor

Garbage in... Color out

The primary SwiftColor storage type is called Pigment. It stores RGBa information about a specific color and has many convenience initializers. The goal is to be able to pass any sort of color-related value, and get a reasonable color out.

// Different ways to initialize with 'Blue'
_ = Pigment(blue: 1.0)
_ = Pigment(blue: 255)
_ = Pigment("blue")
_ = Pigment("#0000FF")
_ = Pigment(0x00F)
_ = Pigment(0x0000FF)

GitHub

link
Stars: 0
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

SwiftColor 0.2.0
1 year ago

This release has two major changes:

  • Renamed 'Color' to 'Pigment': There would have been a continual naming collisions with SwiftUI.Color.
  • Replaced many CGFloat/Float instances with Double: Since the native floating point type in Swift is Double, it seemed logical to have the Pigment storage values use it.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics