gizmosachin / ColorSlider

🎨 Snapchat-style color picker in Swift
MIT License
288 stars 53 forks source link

black and white areas of the spectrum have a hard drop off (different from visual representation) #21

Closed piemonte closed 7 years ago

piemonte commented 7 years ago

would it be possible to match the visuals themselves? pasted_image_at_2017_10_06_08_54_pm_720

gizmosachin commented 7 years ago

Oops, that's really bad and completely unintentional. Will push a fix.

piemonte commented 7 years ago

(sorry, my screenshot represents the behavior not the actual visuals)

gizmosachin commented 7 years ago

Ah okay, no worries!

Based on the way the colors are drawn in the GradientView there'll always be a hard drop off unfortunately (Snapchat's new color picker actually does this as well). I noticed it's particularly bad when you have a longer slider though, so I'll see if I can come up with a fix and push that. If it'd be more preferable to just hide the black and white colors altogether instead (the old behavior), you can also set the insets for black and white to zero:

let gradientView = colorSlider.gradientView
gradientView.blackInset = 0
gradientView.whiteInset = 0
gizmosachin commented 7 years ago

Forget what I said earlier - GradientView now draws the gradient so it's continuous, even with the black and white at the ends. pod update to v4.1 should do the trick. 😄

piemonte commented 7 years ago

🙌