Swiftpack.co - toddheasley/hex as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by toddheasley.
toddheasley/hex 1.0.0
Mix color using hex values
⭐️ 0
🕓 1 week ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/toddheasley/hex.git", from: "1.0.0")


Mix color using hex values in SwiftUI, UIKit and AppKit.


Targets iOS/iPadOS/tvOS 14, watchOS 7 and macOS 11 Big Sur. Written in Swift 5.6 and requires Xcode 13.3 or newer to build.

Example Usage

import SwiftUI
import Hex

let _: [Color] = [
    Color(hex: "FFFFFF"),
    Color(hex: "#ccc", opacity: 0.9),
    Color(hex: 0x0000CC)

Plus, get the hex value of any color constructed from HSB, RGB or hex values:

print(Color(red: 0.0, green: 0.0, blue: 0.8).hex) // 0x0000CC
print(Color(white: 0.8).hexString) // "#CCCCCC"

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