Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

toddheasley/hex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hex

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

Requirements

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"