can you add a block that sets the RGB costume color to something?
The Colors and Crayons library includes a block to set the pen color by rgb. It's not clear what it means to set the color of a costume, since costumes generally have more than one color, but you can shift all the hues with the SET COLOR EFFECT block.
only works if all the costumes of the sprite is one main color.
it would be good if it sets all of the sprite's non-white costume color to the selected rgb, or would set the areas of the main color to that rgb and would set the other areas accordingly. (preferably the second option)
That's much too specialized for your particular application for us to consider as a block for everyone. For example, what's "the main color"? You want us to sort all the pixels and find which color is in the most pixels?
But of course you can write one yourself that does exactly what you want by walking through the costume, pixel by pixel, and set each one to whatever you want, based on the existing value.
is there a script I can use for setting
? (just changed the category)
I don't understand.
The MAP applies your function to each pixel of the costume. A pixel is a list of four numbers [0-255] (the fourth one is alpha, 255 for fully opaque and 0 for fully transparent). You can do whatever you want, turn each green pixel red and each yellow pixel purple, or whatever.
Right, that's why you have to use a more complicated function than just multiplying by a scale factor. Your function will look at the original value of each individual pixel and transform it however you want.
What I think you're not getting is that the particular function you want for your application isn't the same function someone else will want for a different application, so we're not building yours into Snap!; you have to write it yourself.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.