First-class colors (Part 2)

Things I've learned about color today:

  1. What is called "subtractive mixing" is actually done not by subtracting but by multiplying CMY values (on a 0 to 1 scale, so multiplying two values gives a smaller result).

  2. Actual mixing of paints gives a resulting color that isn't the subtractive-mixing combination of the paints' colors, but rather depends on the specific chemistry (such as the shapes of molecules) of the pigments used.

These came from here.

What link?

original post

thank you

spinning disc (additive-averaging) mixing.

A physical meaning for what you're doing! From here.

I may have found a glitch, @helicoptur and @wunder_wulfe :

How can


but

If two colors are different, how come their RBGA is the same? Either this is a glitch with the _ = _ or the saturate color block.

They're different costumes. It's not a glitch with either.


(basically "copy of my costume = my costume")
Costumes don't have special systems to check if they're equal. So they check if each is a different morph, which it is.

In this forum thread : Ability to compare costumes with identical (or = ). That's a really bad idea @bh

[offtopic]Also can everybody at least try to reply faster.[/offtopic]

I've added the ability to check if two colors are equal.
(Also:

It's only been 12 minutes. Have patience.)

and how do you compare 2 colors

it's in the project, but you would compare rgba values

k

let people take their time making posts. We need to think. Not everyone is on at the same time as you (and it's a small-ish community, so don't expect to get replies a few minutes after you post).

hey @bh , how is the colors and crayons library?

The more I learn about color, the further away it gets. But I suppose I should get disciplined and just not do some parts. (I've been hung up on trying to find an algorithm to turn any color into the closest color number.)

check the great and informative wikipedia of info!










(when it's not being vandalized to the point of destruction and pain)












but seriously:

Yeah of course I read Wikipedia first thing!

Okay, here it is:


colors.xml (226.5 KB)
There are six blocks meant for users:

Detailed documentation coming soon, but given Appendix A and the notes below y'all can start debugging this, especially those of you who've been bugging me for it!

The PEN and SET PEN blocks are, sadly, implemented separately from the COLOR FROM and FROM COLOR blocks. The pen remembers how it was last set, and that turns out to be super useful in interpreting what the user means to do next. In particular, FAIR HUE FROM COLOR and CRAYON NUMBER FROM COLOR can give slightly different results from the pen versions. (Well, in the case of the PEN reporter, it'll say "not set" if you ask for a different scale from the one you used to set the pen last.)

Thanks to @cymplecy, the optional pulldown menu inputs in SET PEN and COLOR FROM are different menus depending on the non-optional category pulldown. In particular, the old SET PEN TO CRAYON block is now just one of the choices in SET PEN. Also, if you know the name of your crayon, you can type the name into the input slot and the block will find the crayon number for you, so you don't have to use the pulldown menu.

The menu for crayons includes all 100 possibilities. The ones for color number and fair hue have only a selection, because those are continuous scales, and hardly any of them have names. Those are the only three pulldown menus; if you select category RGB vector or some such, you don't get any pulldown values.

The variadic input at the end of the COLOR FROM block needs explanation. Think of it as a continuation of the slot before it, the one with the pulldown choices. So these are equivalent:


However, there's a difference if you include a transparency:

In the first case, the transparency is separate from the RGB vector, so it's in the usual Snap! scale of 0=opaque, 100=transparent; in the second case, it's a fourth item of an RGBA vector, so it's on the rest-of-world 0=transparent, 255=opaque scale. You can add a transparency to any kind of color format:

Okay, past my bedtime. @helicoptur, I haven't started thinking about MIX yet; now that I understand that "subtractive" really means multiplicative, I might try to do paint mixing after all.

I think the menu code in

image

needs a few try/catch wraps so that it doesn't error out

image

[edit] Revised code to cope with static menu items for these two blocks

image

color2 blocks.xml

Things I've noticed as going through the blocks

image
don't indicate that they are pen values or internal use reporters - suggest they need prefixing

image
also needs some try/catch adding for non-menu values

untitled script pic
error and no help

image
[minor] it's not a reporter

[minor] quite a few missing helps
[edit] Off to read Appendix A to try and get a grasp on all the options :slight_smile: ]