Swiftpack.co - jordanbaird/ColorWell as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by jordanbaird.
jordanbaird/ColorWell 0.2.1
A versatile alternative to NSColorWell for Cocoa and ColorPicker for SwiftUI.
⭐️ 11
🕓 21 hours ago
macOS
.package(url: "https://github.com/jordanbaird/ColorWell.git", from: "0.2.1")

ColorWell

Continuous Integration Release Swift Versions Docs License

A versatile 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. While the goal is for ColorWell to look and behave in a similar way to Apple's design, it is not an exact clone. There are a number of subtle design differences ranging from the way system colors are handled to the size of the drop shadow. However, in practice, there are very few notable differences:

Install

Add the following dependency to your Package.swift file:

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

Usage

Read the full documentation here

SwiftUI

Create a ColorWellView and add it to your view hierarchy. There are a wide range of initializers to choose from, allowing you to set the color well's color, label, and action.

struct ContentView: View {
    @Binding var fontColor: Color

    var body: some View {
        VStack {
            ColorWellView(color: fontColor) { newColor in
                fontColor = newColor
            }

            // ...
            // ...
            // ...

            CustomTextEditor(fontColor: $fontColor)
        }
    }
}

Cocoa

Create a ColorWell using one of the available initializers. Observe color changes using the onColorChange(perform:) method.

let fontColor = NSColor.black

let textEditor = CustomNSTextEditor(fontColor: fontColor)
let colorWell = ColorWell(color: fontColor)

colorWell.onColorChange { newColor in
    textEditor.fontColor = newColor
}

License

ColorWell is available under the MIT license.

GitHub

link
Stars: 11
Last commit: 2 hours ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

ColorWell 0.2.1
Yesterday

This release contains quality-of-life improvements and increases overall drawing efficiency.

Full Changelog: https://github.com/jordanbaird/ColorWell/compare/0.2.0...0.2.1

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