ColorWell

0.0.3

A versatile alternative to NSColorWell for Cocoa and ColorPicker for SwiftUI.
jordanbaird/ColorWell

What's New

ColorWell 0.0.3

2022-10-28T18:19:50Z

ColorWell

An attractive alternative to NSColorWell for Cocoa and ColorPicker for SwiftUI.

ColorWell is designed to mimic the appearance and behavior of the new color well design in macOS 13 Ventura, for those who want to use the new design on older operating systems.

Install

Add the following dependency to your Package.swift file:

.package(url: "https://github.com/jordanbaird/ColorWell", from: "0.0.3")

Usage

SwiftUI

Create a ColorWellView and add it to your view hierarchy. Observe color changes using the onColorChange(perform:) view modifier.

struct ContentView: View {
    var body: some View {
        ColorWellView(color: .purple)
            .onColorChange { print($0) }
  }
}

Cocoa

Create a color well using one of the init() or init(frame:) initializers.

let colorWellDefaultFrame = ColorWell()
let colorWellCustomFrame = ColorWell(frame: NSRect(x: 0, y: 0, width: 400, height: 200))

Observe changes to the color value.

let colorWell = ColorWell()
colorWell.observeColor { color in
    print(color)
}

License

ColorWell is licensed under the MIT license.

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

  • None
Last updated: Tue Dec 06 2022 09:50:07 GMT-0500 (GMT-05:00)