News for hackers. Stuff that matters.
Re:Show HN: My <canvas>-based, Photoshop-esque JavaScr... by spicyj on Wednesday August 25, 2010 @08:33PM (#1634652)
I made this for the An Event Apart JavaScript 10k contest but unfortunately finished it after the deadline (but not by much!).

Anyway, here it is for all of you to enjoy. Hopefully useful when you don't feel like opening up Photoshop to get a CSS color.

I'd love to hear suggestions for how I can improve it. (Sorry that the bubbles next to Lab are missing; refreshing the square on the left was too slow for it to be useful.)

Re:Show HN: My <canvas>-based, Photoshop-esque JavaScr... by bd on Thursday August 26, 2010 @08:50AM (#1635766)
If you want to have it much faster, use transparent PNG image for saturation-value rectangle instead of drawing everything in canvas and then just color its background property according to hue.

Long ago I needed color picker, so I did research many options. This was the most efficient implementation I found (the trick I described above comes from here):

http://ecritters.biz/colorselector/

Re:Show HN: My <canvas>-based, Photoshop-esque JavaScr... by ELV1S on Thursday August 26, 2010 @09:02AM (#1635791)
I've made one for 10K too http://10k.aneventapart.com/Entry/235. Mine is SVG based. The code is on GitHub http://github.com/NV/color-blender.
Re:Show HN: My <canvas>-based, Photoshop-esque JavaScr... by daychilde on Thursday August 26, 2010 @09:32AM (#1635856)
I really like being able to select two colours like that - and the in-between colour is even better. Love that.
Re:Show HN: My <canvas>-based, Photoshop-esque JavaScr... by daychilde on Thursday August 26, 2010 @09:30AM (#1635852)
It would be really cool to see CMYK support - I prefer HSL to RGB to find good colours that work together; but I prefer CMYK to even HSL

It would also be cool if multiple copies of the tool could dynamically be added to pick multiple colours at a time - with, say, up to eight blocks at the top showing the current colour for each selector, and a text box to easily copy the various colours...

Thanks for sharing - this is nice!

Re:Show HN: My <canvas>-based, Photoshop-esque JavaScr... by spicyj on Thursday August 26, 2010 @04:52PM (#1637128)
I'm not quite sure how this would work; the color models I have currently are three-dimensional so can be specified by three pieces of information (square x, square y, bar y). CMYK is 4-dimensional so you'd need something like 2 squares to specify a color. (Note that Photoshop's color picker doesn't have bubbles next to CMYK.)
Re:Show HN: My <canvas>-based, Photoshop-esque JavaScr... by jp_sc on Wednesday August 25, 2010 @10:41PM (#1634900)
Really nice, congratz.

Instead of using images, the square and slider markers could be drawed on an extra canvas on top.

Re:Show HN: My <canvas>-based, Photoshop-esque JavaScr... by DrJokepu on Thursday August 26, 2010 @05:59AM (#1635508)
I don't think (programmatically) drawing everything is a good idea. Sprites have been used in computer graphics since time immemorial because they're easy to implement, maintain, change and can offer performance improvements as well.

Just imagine the hassle you have to go through if you want to change a programmatically rendered sprite as opposed to opening it in an image editor and simply changing it there.