Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Color Picker Library - add a color picker to your app with just one line of code!
Started by schroederapps Mar 24 2014 04:48 PM

5 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

schroederapps

[GLOBAL: userInfoPane.html]
schroederapps
  • Pro
  • PipPipPipPipPipPip
  • 161 posts
  • Jedi

Hi Everybody,

 

Just wanted to let you all know that I'm sharing what I think is a pretty great color picker library/module. It is Graphics 2.0-compatible, and brings up an Adobe-style color picker box along with an alpha channel slider with just one line of code. I borrowed heavily from StarCrunch's Code Exchange post from last year (http://developer.coronalabs.com/code/color-picker), but I think I made enough improvements to say my picker can stand alone as a separate product.

 

I wrote a blog post about it on my own site, with details on usage and a sample project you can download: http://www.jasonschroeder.com/2014/03/24/add-a-color-picker-to-your-corona-app-with-one-line-of-code/.

 

You can also find the colorPicker.lua library file on the Corona Labs Code Exchange: http://code.coronalabs.com/code/color-picker-color-picker-your-app-just-one-line-code

 

Here is a video of how it looks in action:

 

Hope some of you find it useful!



[TOPIC: post.html]
#2

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Enterprise
  • PipPipPipPipPipPip
  • 2,184 posts
  • Jedi


[TOPIC: post.html]
#3

tschussler

[GLOBAL: userInfoPane.html]
tschussler
  • Pro
  • PipPipPipPipPipPip
  • 55 posts
  • Jedi

+1 Jason - well done and great work showing examples of usage on your website.



[TOPIC: post.html]
#4

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Starter
  • PipPipPipPipPipPip
  • 77 posts
  • Jedi

Ah, very cool.

 

Alpha cropped up in my mind occasionally while doing the original, but I was never sure how much I'd need it. I've still been too lazy to make the horizontal bar option. :)

 

I didn't dig too far to see what you preserved, but if you're having issues with drags snagging on edges / corners, I've since fixed that up: https://github.com/ggcrunchy/corona-sdk-snippets/blob/master/ui/ColorPicker.lua#L88 and thereabouts. (A bunch of the color code has been pulled into another module, but I think the relevant stuff is still there.)



[TOPIC: post.html]
#5

schroederapps

[GLOBAL: userInfoPane.html]
schroederapps
  • Pro
  • PipPipPipPipPipPip
  • 161 posts
  • Jedi

Thanks tschussler, and thanks for commenting, StarCrunch! I already made it so that the picker will keep tracking your finger, even if you slide it off the edge of the box/bar, but thanks! And really, I wouldn't have put this thing together nearly so quickly without having your code to work off of, so thanks a ton for sharing!



[TOPIC: post.html]
#6

Skatan

[GLOBAL: userInfoPane.html]
Skatan
  • Pro
  • PipPipPipPipPipPip
  • 518 posts
  • Jedi

Awesome work and thanks a lot for sharing!! Extremely useful library!




[topic_controls]
[/topic_controls]