jacobobryant / platypub

A publishing platform built with Biff
MIT License
65 stars 13 forks source link

Better color picker component #8

Closed jacobobryant closed 1 year ago

jacobobryant commented 2 years ago

Currently we're just using a text field:

image

After searching for "javascript color picker component" I see that <input type="color"> is a thing?! (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color). That might be a good option. Either that or some drop-in component like jscolor.

jeffp42ker commented 2 years ago

This tool provides color advice for cartography: https://colorbrewer2.org/

It might be useful in picking colors for a theme too somehow? Maybe completely outside the app.

jacobobryant commented 2 years ago

Hm could be--this could be a good fit for a "Resources for theme developers" section, perhaps in the README.

joerter commented 1 year ago
Screenshot 2023-02-21 at 9 57 42 PM

How's something like this look? It's an input[color] on the left and the normal text input on the right. I'm thinking they could be 2 way bound so an update in either updates the other.

jacobobryant commented 1 year ago

That looks good to me. Too bad the native color component doesn't just come with hex input... Anyway, I think you could do the data binding with a couple of hyperscript one liners, something like :_ "on change set #text-input's value to my value" and vice versa (that may or may not be the right syntax).