a simple color picker

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Alexar
Party member
Posts: 174
Joined: Thu Feb 05, 2015 1:57 am
Location: Chengdu,China

a simple color picker

Post by Alexar »

hi everyone,
i wrote a in game color picker for my project. and i am grad to share it. all suggestions are welcomed.
screenshot.png
screenshot.png (41.2 KiB) Viewed 7683 times
demo.love
(2.06 KiB) Downloaded 283 times
Desktop.love
(2.46 KiB) Downloaded 427 times
new version comes up. i used @qubodup's ui.
now you can hold your mouse freely and no need to worry about losting focus to the picker.
Last edited by Alexar on Tue Jul 07, 2015 2:39 am, edited 1 time in total.
Muzz
Citizen
Posts: 54
Joined: Sun Jun 28, 2015 1:24 pm

Re: a simple color picker

Post by Muzz »

Cool!

I might have a use for this straight away!

Just a question why are you calculating the rgb with decimal accuracy? 8 bit images only have a precision of 255 per channel. one major usability function i would suggest is to start the picking on the down click, but keep it as a bool that isn't reset until the user unclicks regardless of if the players mouse is over the top of the picker or not. It is super annoying to have the thing stop because it's hard to keep the mouse on the ring exactly.

Also, why does the value and saturation change when you click on the hue ring? that should be locked and not change until you set that manually.
User avatar
qubodup
Inner party member
Posts: 775
Joined: Sat Jun 21, 2008 9:21 pm
Location: Berlin, Germany
Contact:

Re: a simple color picker

Post by qubodup »

Very nice! I hope some games will use it.

Issues
- missing terms of use (I recommend zlib/libpng license or cc0/public domain)
- using outer ring returns floating point numbers at times (I math.floor'ed them in the demo).
- it seems impossible to pick full saturation/black/white because the triangle touches the circle.
- scaled up, the circle is split (which looks cool though)

I made a prettier demo. My changes are cc0/public domain (no need to mention) but consider the font license info - it seems cc0/public domain like but I recommend including the text file.


http://youtu.be/0uAnn3_-Wwc
Attachments
color_picker.love
(15.64 KiB) Downloaded 216 times
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
User avatar
MicroMacro
Citizen
Posts: 92
Joined: Fri May 30, 2014 2:30 am
Location: Boston, MA, USA
Contact:

Re: a simple color picker

Post by MicroMacro »

I was wondering if I could use either of your color pickers in a project of mine? I don't know exactly what this project is yet, but I can see it being very useful. All credit will be given.
https://github.com/ebernerd- where you can find all my work.
User avatar
Alexar
Party member
Posts: 174
Joined: Thu Feb 05, 2015 1:57 am
Location: Chengdu,China

Re: a simple color picker

Post by Alexar »

Muzz wrote:Cool!

I might have a use for this straight away!

Just a question why are you calculating the rgb with decimal accuracy? 8 bit images only have a precision of 255 per channel. one major usability function i would suggest is to start the picking on the down click, but keep it as a bool that isn't reset until the user unclicks regardless of if the players mouse is over the top of the picker or not. It is super annoying to have the thing stop because it's hard to keep the mouse on the ring exactly.

Also, why does the value and saturation change when you click on the hue ring? that should be locked and not change until you set that manually.

thanks man, because results of the convertion from HSV to RGB is not in integer, i passed it directely. i'ill math.floor() the returns.
for the position in the triangle....ok, i ll set it to the same relative position.
User avatar
Alexar
Party member
Posts: 174
Joined: Thu Feb 05, 2015 1:57 am
Location: Chengdu,China

Re: a simple color picker

Post by Alexar »

qubodup wrote:Very nice! I hope some games will use it.

Issues
- missing terms of use (I recommend zlib/libpng license or cc0/public domain)
- using outer ring returns floating point numbers at times (I math.floor'ed them in the demo).
- it seems impossible to pick full saturation/black/white because the triangle touches the circle.
- scaled up, the circle is split (which looks cool though)

I made a prettier demo. My changes are cc0/public domain (no need to mention) but consider the font license info - it seems cc0/public domain like but I recommend including the text file.


http://youtu.be/0uAnn3_-Wwc
i like your demo, mine is just for showing it's simple to use.
you like the ring with lines or just a whole ring? you can edit the setLineWidth(3) to setLineWidth(self.size/100)
i forgot to translate the license to english that i wrote in chinese. free to use and no need to mention but dont claim it as your own.
User avatar
Alexar
Party member
Posts: 174
Joined: Thu Feb 05, 2015 1:57 am
Location: Chengdu,China

Re: a simple color picker

Post by Alexar »

MicroMacro wrote:I was wondering if I could use either of your color pickers in a project of mine? I don't know exactly what this project is yet, but I can see it being very useful. All credit will be given.
feel free to use and i will fix something in the later version, plz keep on focus of this lib.
Muzz
Citizen
Posts: 54
Joined: Sun Jun 28, 2015 1:24 pm

Re: a simple color picker

Post by Muzz »

Awesome! New version has much nicer mouse behaviour!

I'm going to be using a version of this in Colour Constructor, so your code is going to be used by hundreds of artists. I must say man, that's some damn dense code without any comments. I may upload a commented version after i work out how everything works if you don't mind?

I'm going to add in Bool's to stop things rotating as most artists just find it annoying, but i guess it's not hard to leave in an option to keep it rotating if you want.
User avatar
Alexar
Party member
Posts: 174
Joined: Thu Feb 05, 2015 1:57 am
Location: Chengdu,China

Re: a simple color picker

Post by Alexar »

Muzz wrote:Awesome! New version has much nicer mouse behaviour!

I'm going to be using a version of this in Colour Constructor, so your code is going to be used by hundreds of artists. I must say man, that's some damn dense code without any comments. I may upload a commented version after i work out how everything works if you don't mind?

I'm going to add in Bool's to stop things rotating as most artists just find it annoying, but i guess it's not hard to leave in an option to keep it rotating if you want.
thanks man, english is not my native language, i deleted comments in chinese :(。 just perform a surgery to this little one please ^^
User avatar
yancouto
Prole
Posts: 8
Joined: Sat Jan 21, 2017 2:14 pm

Re: a simple color picker

Post by yancouto »

This latest version did not work with LÖVE 0.10.

I fixed it (it just needed some renames), hope it is useful.
Attachments
color_picker.love
(15.63 KiB) Downloaded 190 times
Post Reply

Who is online

Users browsing this forum: No registered users and 166 guests