颜色选择器

ColorPicker 是一个用于选择颜色的 UI 组件。

要求

安装

将包依赖项添加到你的应用

开始使用

呈现 ColorPicker

import ColorPicker
...
let vc = ColorPickerViewController()
vc.setDelegate(self)
present(vc, animated: true)

自定义色板颜色

let vc = ColorPickerViewController()
var configuration = ColorPickerConfiguration.default
configuration.initialColor = .red
configuration.initialColorItems = [.init(id: UUID(), color: .red)]
vc.configuration = configuration
vc.setDelegate(self)
present(vc, animated: true)

处理颜色更改

extension ContentViewController: ColorPickerViewControllerDelegate {
    func colorPickerViewControllerDidFinish(_ viewController: ColorPickerViewController) {
        print(#function, viewController.selectedColor)
    }
    
    func colorPickerViewController(_ viewController: ColorPickerViewController, didSelect color: UIColor, continuously: Bool) {
        print(#function, color, continuously)
    }
}

使用 ColorPicker 的应用

维护者

@noppefoxwolf

许可证

ColorPicker 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。

禁止事项 🚫

禁止为了伪装垃圾邮件帐户的活动为合法帐户而进行 Fork 或贡献。