Hacker News new | past | comments | ask | show | jobs | submit login

I wanted to create an elegant and unusual color selector interface that was still easy to learn and fun to use.

A feature I like is that every color you create is kept on the palette so you can build new colors upon previous ones. It's also kind of a natural way to create a history of the colors you used. Colors that are removed from the palette are kept on the side so you can temporarily reduce the complexity of the palette.

For the technical side, it is made with regular js/html/css and webgl, no framework is required. It is supposed to work on touch devices as well as desktop computers.

This is still a bit experimental so I'd be very happy to have some feedback. Thank you!




It was beautiful!

I think it needs some work to make it "learnable". It wasn't obvious to me whether the colours on the side were the final palette, or the "trash can".

It might be nice to have a way to see multiple colours together in a "demo". At the moment you just see one colour as the background.

Lastly I'm not sure that dragging to the side is very intuitive as a way of removing the colour. It mixes two things up - moving the colour to adjust the palette, and getting rid of it. Maybe the user could double-click instead.

All that said, I thought this was great and really fun and intuitive.


Thank you for this constructive feedback!

I'll add the double-click for the deletion, you are not the first person to suggest it.

I have to admit the colors on the side are a bit of an afterthought. You need some diversity to be able to create the colors you want. If you can't retrieve the deleted colors you can be stuck. I agree its role is not obvious. I don't know how to fix that but I'll keep the issue in mind.

I'm not sure what you mean about the "multiple colours in a demo". I think the demo is missing some kind of "real world usage" aspect. At the same time I tried to keep it focused on the component itself. Maybe I'll add an example to the readme tomake things clearer


Nice work! Maybe start a palette on the left side with a set of prime colors like a painter would?


I really like this idea! It's quite fun to play around with, but it feels like there's not a lot of deliberate choice I can make. It also just works really well and is super smooth. One thing that could be improved about rendering are the edges of the polygon. They look very washed out, even on my 14" UHD display. A little bit like a very low-quality AA was used.

What's a little annoying is that colours jump around when I move anchors closer or farther away from each other, but I guess there's no good solution for that.

Also, it would be nice if the connections between the anchors were less obvious. Right now, they're very clearly visible straight lines. Not sure how that could be solved, though, either.

What colour space are you using for all the transitions?

That sounded quite negative, but I really like what you've done here, it's a very creative approach to an otherwise technical topic.


Thank you, it doesn't sound negative at all, in fact you raise interesting points!

the "obviousness" of the connections is tricky. The blending is in the linear RGB space. I initially tried sRGB but it was terrible. I'm not sure how to improve it. At the moment the interpolation is done through the varyings between the vertex and fragment shader. This is quite limiting.

About the lack of deliberate choice, in theory you can reach any rgb color. In practice this is limited by the initial colors I chose (they are smoother than pure RGB-CMY). I'm not sure how much of the RGB space I'm missing.

For the antialiasing issue I'll look into it. I'm not sure I correctly set the AA in webgl. Could also be due to some issue with the size of the canvas

Thank you again!


Interpolate in a perceptual space such as Oklab?

Possibly use a radial basis function for interpolation rather than triangles? I don't have JavaScript code handy but rbf-interp[1] is Rust code that could either be adapted or called from wasm.

[1]: https://crates.io/crates/rbf-interp


The triangles-based interpolation is indeed problematic. It has the advantage to be fast and super easy to implement in webgl with an arbitrary number of points. I don't understand everything yet about the rbf interpolation but it looks very interesting, I'll look into it.

A better color space can also help with some issues (in the demo the darker colors are harder to reach when blending with the black point than lighter colors are when the white point is involved) but how I understand it the colors in a triangle are influenced by the colors and shapes of the surrounding triangles, whatever the color space.

I must say that I'm very happy to have had your input on this. I'm a big fan of your work and your blog is a real treasure!

Thank you!


This! Interpolating in linear RGB space is the biggest issue, I'm sure it will improve a lot simply by using a more suitable colorspace. Triangles might not be noticable at all then, except in extreme cases (which are undesirable anyways).


I'll try a different color space, for sure, but I think the interpolation method is the real culprit. I have the feeling that in a configuration like this:

  A-B
  |/|
  C-D
the position of D could have an impact on how ABC is rendered.

But I'll try another color space first, it should be easier to implement.


You mentioned not wanting to package it for frameworks, and mentioned Svelte. I just want to point out that Svelte has native support for vanilla JavaScript and html, so this will work out of the box like any other JS library. Just want to let you know since your README suggests otherwise!

Anyways, awesome work :)




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: