Color Stuff

added some blocks that lets you interact more with colors outside of HSBT, including a few more blocks for RGBA, and (using JS so conversions don’t take too long) OKLAB. plus, an extra utility block (technically 3, one for each of the 3 color models) that lets you merge 2 colors based on the transparency of the first one.

project link

feedback is appreciated!

disclaimer

i know JS doesn’t have to be used, but for the sake of speed, it is.

You can put a 4 item list into the color block to enter RGBA

more color blocks script pic

There’s no need for the clr_rgba() extension function anymore.

And looking at your javascript code, you’re doing nothing that would be slow in snap.

i didn’t realize that. i guess i could attempt the argument of the default values that my block adds, since the handling of lists less than length 4 seems to differ from the handling of my block.

for more heavy-duty use cases, the JS block is faster by a long shot.
more color blocks script pic
though, i am biased here, because i made the JS versions so i could use them in another project im working on that hugely benefits from the usage of JS.

Well, yeah, if you’re doing super heavy duty stuff that needs every bit of speed, but at the point it’s better to just write it all in javascript. For most people, the snap speed is fast enough.

yeah, i guess you’re right. i’ll make the JS part optional.

done, added a toggle to each OKLAB block.

image
You can prevent the arrow drag by setting the slot to “static”

i’m aware, but inside the OKLAB blocks, it’s easier for me to do something like
more color blocks script pic (1)
rather than

Rather than asking if JavaScript should be used as an arguement, you can just always use JavaScript unless that’s turned off. The easiest way to detect that is by catching an error after trying to perform JavaScript.

\

You can actually mark variadic inputs as static after having existing “input list” uses of that block and those “input list” locations will remain untouched.

i’m surprised i didn’t think of this. updated, thank you!