Giter VIP home page Giter VIP logo

chromacolorpicker's People

Contributors

cloke avatar jayvolr avatar joncardasis avatar manraajnijjar avatar pvieito avatar v-fexrt avatar valerianb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chromacolorpicker's Issues

currentHandle not initialized?

I have noticed that currentHandle is not initialized until you move one handle first? This means, that if you first try to change brightness slider, handle (color) is not affected.

I've fixed this with:

// The last active handle.
// SABI TWEAK
// SABI TWEAK
// SABI TWEAK
public var currentHandle: ChromaColorHandle?
//private(set) public var currentHandle: ChromaColorHandle?

And setting currentHandle manually.

Support for Hiding the '+' on the Add Button

Looking at the ChromaAddButton it would be really easy to hide the '+' button (which is functionality I would like/need) but I was wondering how you would like that added as it may affect the public API.

If you would prefer to not have this added, I will likely just add it to my personal fork.

3 Swift Compiler Warnings with XCode 10 beta 6

Pods/ChromaColorPicker/ChromaColorPicker/ChromaShadeSlider.swift:50:14: 'let' properties are implicitly 'final'; use 'public' instead of 'open'

Pods/ChromaColorPicker/ChromaColorPicker/ChromaShadeSlider.swift:51:14: 'let' properties are implicitly 'final'; use 'public' instead of 'open'

Pods/ChromaColorPicker/ChromaColorPicker/ChromaShadeSlider.swift:28:14: 'let' properties are implicitly 'final'; use 'public' instead of 'open'

Checkmark instead of plus icon on ChromaAddButton

My current "workaround" is this:

colorPicker.addButton.plusIconLayer?.removeFromSuperlayer()
colorPicker.addButton.setImage(#imageLiteral(resourceName: "baseline_check_black_24pt"), for: .normal)
colorPicker.addButton.tintColor = .white
colorPicker.addButton.bringSubview(toFront: colorPicker.addButton.imageView!)

But it would be nice if the library had this functionality itself.
Maybe an enum of styles with .plus and .checkmark which when changed, swaps the currently shown CASShapeLayer.

Picker subviews not aligned on first layout

In my app, I draw the picker, but the subviews are not centered on the picker. it is very obvious in iPad.

screen shot 2018-06-02 at 05 32 47

I'm setting it up like this:

        let minwh = 300.0
        let pickerSize = CGSize(width: minwh*0.8, height: minwh*0.8)
        let pickerOrigin = CGPoint(x: view.bounds.midX - pickerSize.width/2, y: view.bounds.midY - pickerSize.height/2)

        /* Create Color Picker */
        colorPicker = ChromaColorPicker(frame: CGRect(origin: pickerOrigin, size: pickerSize))
        colorPicker.translatesAutoresizingMaskIntoConstraints = false

and I think the issue is that the subviews are based on the beginning of the frame rect while the color picker is centered in the stack view.
However, calling colorPicker.layout() after the stackview is created does not help.

How could I add event to the home handle?

I created a customHandle, and a homeHandle,
and add snapkit constraints to the homeHandle, so that the home handle will be shown around the colorPicker, not inside the color picker. But the home handle could not respond to the touchUpInside of the ColorPicker. while the customHandle respond to the event. If I remove the snapkit constraints, it respond to the event too. How could I add event processing code to the Home Handle? I hope the color picker could be closed after user click the home handle.
`

    // Add handle with reference
    let customHandle = ChromaColorHandle()
    customHandle.color = UIColor.purple
    colorPicker.addHandle(customHandle)
    
    let homeHandle = colorPicker.addHandle(at: .purple)
    let customImageView = UIImageView(image: #imageLiteral(resourceName: "home").withRenderingMode(.alwaysTemplate))

    customImageView.contentMode = .scaleAspectFit
    //customImageView.tintColor = .white
    homeHandle.accessoryView = customImageView
    homeHandle.accessoryViewEdgeInsets = UIEdgeInsets(top: 35, left: 15, bottom: 30, right: 30)

    homeHandle.snp.makeConstraints{(make) ->  Void in
        make.left.equalTo(colorPicker.snp.left).offset(10)
        make.top.equalTo(colorPicker.snp.top).offset(20)
    }

`

Issue when archiving

When archiving, I saw the following error: Target 'Pods-AppName' of project 'Pods' was rejected as an implicit dependency for 'Pods_AppName.framework' because its architectures 'arm64' didn't contain all required architectures 'armv7 arm64'

However, the architecture in the pods was listed as armv7 arm64 and armv7s. The solution that worked for me was to update cocoapods and reinstall the pod.

gem update cocoapods
pod install 

I hope that helps someone else.

Would a ChromaShadeSlider setCurrentValue function be valuable?

I have the function below that sets the current value of the ChromaShadeSlider

// This is inside of ChromaShadeSlider.swift
open func setCurrentValue(value: CGFloat){
    currentValue = value
    handleCenterX = (((currentValue / 2)+0.5) * trackLayer.bounds.width) + (handleWidth/2)

    self.layoutHandleFrame()
}

would it be valuable to pull in?

It is currently possible to just directly set the current value with colorPicker.shadeSlider.currentValue = 1.0; but that doesn't seem to update the handle correctly

adjustToColor() doesn't play nicely with supportsShadesOfGray

Hello,

I'm trying to create a pretty simple color selection view and have had a lot of problems with trying to use adjustToColor() with colors only achievable in grayscale. When adjusted to a grayscale color in full color mode or vice versa, the currentColor of the picker seems to become pretty erratic. It's hard to quantify the exact issue, but I think that the adjustToColor() method needs to somehow take grayscale mode into greater consideration.

Thanks,

Kevin

AdjustToColor does not update shade slider

Hi,

When call the adjustToColor method on your colorPicker, it does adjust to the color I picked in the circular picker, but not the shade slider, which results in another color being loaded in the picker than I intended. Would it be possible to create a workaround for this?

Alpha color scroll not working smoothly

When ChromaColorPicker is presented over a viewController, The alpha adjustment scroll(supportsShadesOfGray) is not smooth.

`import UIKit
import ChromaColorPicker

class ColorPickerController: UIViewController {
let picker = ChromaColorPicker(frame: CGRect(x: 0, y: 0, width: 350, height: 350))
    override func viewDidLoad() {
        super.viewDidLoad()
        picker.padding = 5
        picker.stroke = 3
        picker.hexLabel.textColor = UIColor.white
        picker.supportsShadesOfGray = true
        picker.center = self.view.center
        view.addSubview(picker)
        view.backgroundColor = .black
    }

}`

import UIKit
import ChromaColorPicker

class ViewController: UIViewController,ChromaColorPickerDelegate {
    func colorPickerDidChooseColor(_ colorPicker: ChromaColorPicker, color: UIColor) {
        print(color)
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        setup()
    }
    func setup(){
        let newController = ColorPickerController()
        newController.view.frame = self.view.frame
        newController.picker.delegate = self
        present(newController,animated: true)
    }
}

Autolayout issue

Added the ChromaColorPicker as a subview in IB.

Screen Shot 2020-07-22 at 10 53 21 PM

Set it's top, bottom, trailing and leading constraint to safe area (i.e. constant = 0).

Screen Shot 2020-07-22 at 10 54 03 PM

There is a weird asymmetric circle crop going on.

Screen Shot 2020-07-22 at 10 50 20 PM

Is it a requirement that this view be instantiated programmatically and hardcoded to a certain width/height?

Crash if presented within a modal view controller

When presenting a modal controller containing a colorPicker, the following error occurs:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'View has lost track of its superview, most likely through unsupported use of CALayer API on the view's layer. If this isn't a crash yet, it will be in the near future. 
	Problem view: <ChromaColorPicker_Demo.ChromaHandle: 0x7fd7fcb07e70; frame = (75.0135 0; 24.096 24.096); userInteractionEnabled = NO; layer = <CALayer: 0x600000422680>>
	Expected parent: <ChromaColorPicker_Demo.ChromaShadeSlider: 0x7fd7f9d0e0e0; baseClass = UIControl; frame = (78.5385 220.572; 174.123 24.096); gestureRecognizers = <NSArray: 0x60000005b8a0>; layer = <CALayer: 0x6000004231a0>>
Break on UIViewReportBrokenSuperviewChain to debug.'

Suggested fix: in ChromaShadeSlider.swift

Replace:

self.layer.addSublayer(handleView.layer)

by:

self.addSubview(handleView)

Suggestion: set default handle

When you set a brightness slider and connect it to a picker, the color picker doesn't respond to slider update, unless the user starts dragging the handle.
To avoid this unexpected behaviour I suggest to set colorPicker.currentHandle = colorPicker.handles.last when a handle is added to the picker.

iOS 14 issues in modal

when this picker is presented in a modal in iOS 14, the "swipe down to dismiss" behavior of the modal makes the picker very difficult to use. seems like the touch is being recognized by the control as well as the navigation controller

Crashes in iOS 9

The app is getting crashes in iOS 9 when building it from Xcode 12

I am using the ChromaColorPicker library version 1.8.0

Please give me a solution

Thanks

BUG: adjustToColor does not update the currentColor

When calling adjustToColor, the variable currentColor does not always update itself.

This seems to happen when only the shade of the color was changed.

Looking at the code, it doesn't make sense since I can see it being set from adjustToColor. However, the only fix I've found is to change currentColor to a public variable, and to set it to the same value as the one adjustToColor is called with:

colorPicker.adjustToColor(targetColor)
colorPicker.currentColor = targetColor

Change handle of place

Trying to change a previously added handle of place programatically doesn't work, the slider brightness slider moves but the handle in the color picker doesn't. How can I change the handle to a certain color programmatically?

Support full RGB color scope

Hi, this is a slider with great UX! However to be adopted by apps that is serious about colors it should be support full color scope. As I understand it, Chroma Picker's UI represents HSL model of a color: The radial slider pick Hue value, the horizontal slider picks Luminosity value but there is no slider for chosing Saturation.

That is very unfortunate omission. I suggest that to add option (property) that will enable choosing any RGB color from RGB scope: It will add one more horizontal slider for Saturation in place of Hex value label. If the hex value label needs to be kept (I do not think it's necessary) in full scope mode it should be in smaller font above new Saturation slider.

It would be also great to have Alpha value slider but I admit that I would not know where to put it without breaking the design.

Problems with AutoLayout

This library has some pretty major issues with AutoLayout that should be looked into.

I was unable to get the ColorPicker to render properly until I constrained its width and height to a constant. I would of loved to use an aspect ratio constraint with leading+trailing margins to the superview, but no matter the combinations I used, the ColorPicker would render its subviews all over the screen.

I am not an AutoLayout newbie, so I know my constraints were valid. I can provide more detail if needed.

color picker handle

It is impossible to change size of Color Picker Handle, that small circle.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.