Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shades of gray not supported? #3

Closed
rogomantik opened this issue Oct 10, 2016 · 8 comments
Closed

Shades of gray not supported? #3

rogomantik opened this issue Oct 10, 2016 · 8 comments

Comments

@rogomantik
Copy link

Shades of gray not supported?

@Laptopmini
Copy link

+1

@V-FEXrt
Copy link
Contributor

V-FEXrt commented Jul 25, 2017

@joncardasis Ideally this is something I would like to have as well. Maybe it is something we can work on together?

@joncardasis
Copy link
Owner

I've played with the idea before (I'm just getting to maintaining some older projects atm like this one). I'm curious of how shades of gray could be supported with the current design of the control since the ring is based on hue and the slider is based on intensity and blends between black and white.

The picker should be able to select a gray color rgba(0.5, 0.5, 0.5, 1) and then the shader could take care of the spectrum between gray and black and gray and white respectively.

@V-FEXrt One idea I came up with is this:
idea

When the handle is lifted up and if a supportsShadesOfGray: Bool property is true, then the middle plus button will become gray, the plus will disappear and the handle can move freeform within the bounds of the circle. (Since color is based on the angle from the center point this could still work)

If the handle is moved to the center button (using CGRects contains(_ :) method) the handle color changes to gray and if let go it will go back to the original lifted space on the circle and become gray. The shade slider would work just fine from there.

This would require quite a bit of rework as to how the control functions and making sure everything 'snaps' into place.

@V-FEXrt how does this appeal to you? Any suggestions are welcome 😸

@joncardasis
Copy link
Owner

Sitting on the idea I found one I think I'll be implementing soon.

possible-solution

What I am now planning to do:

  • Add a public var supportsShadesOfGray: Bool property
  • When supportsShadesOfGray is true a toggle indicator will appear in the upper left of the control
  • This toggle indicator will be gray when the picker is in "hue mode" and when tapped, will turn to an arbitrary color and the picker will switch to "grayscale mode"

This way it is optional to implement, minimal effort, doesn't break the current design pattern, and allows for shades of gray.

@V-FEXrt
Copy link
Contributor

V-FEXrt commented Jul 25, 2017

Hmm, I really like the first suggestion, but the second one seems more reasonable, and perfectly acceptable for what I need. Is there anything in the implementation that you would like me to help with?

@joncardasis
Copy link
Owner

joncardasis commented Jul 25, 2017

@V-FEXrt I just went ahead and merged to master. Hopefully, this solution will work for those who need shades of gray 👍

@joncardasis
Copy link
Owner

I am closing this issue as gray shades are now supported :)

@V-FEXrt
Copy link
Contributor

V-FEXrt commented Jul 26, 2017

Looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants