Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to code a color wheel/color picker?
- Obsolescence
-
15 posts
How to code a color wheel/color picker?
I want to attempt a character-maker on scratch. Instead of making items (such as hair, eyes, etc) and recoloring them individually, I was thinking of making just one version of each with the option to recolor with a color wheel. Many games off scratch have it, so I'd guess it's possible to make. Though I haven't seen anything like it on scratch. I'm not an expert coder, either. The only thing I know is that it would have to do with graphic effects (setting color effect to a certain number to get the desired color). Any suggestions would be helpful! ^^
- a1dang
-
100+ posts
How to code a color wheel/color picker?
You COULD make a bunch of different costumes for a sprite, and have a wheel somehow change between these, but that's not really feasible, because the amount of costumes you would need would easily reach the scratch project size limit very quickly.
Another option that wouldn't use up the storage space, but might require a bit more work, would be to have the characters drawn with pen instead. This would give you access to a lot more colors, without a bunch of extra costumes. You could maybe do something like the following (assuming dot is the sprite you drag around a color wheel, and hat is the sprite that draws the hat)
If dot is touching color (Color Goes here), then {
set pen color (Color Goes here);
drawhat
}
It would require you to make a very, very long script that checked for a bunch of different colors, but still would use less storage than the costume idea (and would be easier to code)
And, of course, the third option would be the color effect that you mentioned.
Another option that wouldn't use up the storage space, but might require a bit more work, would be to have the characters drawn with pen instead. This would give you access to a lot more colors, without a bunch of extra costumes. You could maybe do something like the following (assuming dot is the sprite you drag around a color wheel, and hat is the sprite that draws the hat)
If dot is touching color (Color Goes here), then {
set pen color (Color Goes here);
drawhat
}
It would require you to make a very, very long script that checked for a bunch of different colors, but still would use less storage than the costume idea (and would be easier to code)
And, of course, the third option would be the color effect that you mentioned.
- Obsolescence
-
15 posts
How to code a color wheel/color picker?
You COULD make a bunch of different costumes for a sprite, and have a wheel somehow change between these, but that's not really feasible, because the amount of costumes you would need would easily reach the scratch project size limit very quickly.
Another option that wouldn't use up the storage space, but might require a bit more work, would be to have the characters drawn with pen instead. This would give you access to a lot more colors, without a bunch of extra costumes. You could maybe do something like the following (assuming dot is the sprite you drag around a color wheel, and hat is the sprite that draws the hat)
If dot is touching color (Color Goes here), then {
set pen color (Color Goes here);
drawhat
}
It would require you to make a very, very long script that checked for a bunch of different colors, but still would use less storage than the costume idea (and would be easier to code)
And, of course, the third option would be the color effect that you mentioned.
That makes sense! ^^ I'm glad to see something like this is somewhat possible.
The first option is definitely not feasible, especially since I wouldn't have the time or energy to make costumes to account for every RGB combination anyways. Pen could work, though the times I've tried to use it, it's lagged really bad for me.
I've been thinking of drawing each option once, and have it colored white/gray. The color wheel would be separate from the item, but when a specific color on the wheel is clicked, it would change the color using graphic effects.
Pondering this, I did have a second idea, where instead of a color wheel, a color slider is used- since it would take up less space. I would guess that could be coded similarly to the color wheel? The general idea either way is to start with pre-drawn costumes in vector and use graphic effects to change the color. Maybe a slider or function for brightness as well.
- Jlerpy
-
1000+ posts
How to code a color wheel/color picker?
Here's a thing I whipped up a while ago. See if that helps?
https://scratch.mit.edu/projects/696054344/
https://scratch.mit.edu/projects/696054344/
- Scratch-Minion
-
1000+ posts
How to code a color wheel/color picker?
This project shows how you can change sprite colours with a slider or a colour picker: https://scratch.mit.edu/projects/748949231/
Note that you make the Cat sprite Red to start with.
Do not make the Cat with grayscale colours. Gray colours from black to white have saturation = 0.
If saturation = 0, it means the strength of the sprite color is 0. Then the sprite will not change color when you change its Color Effect.
Note that you make the Cat sprite Red to start with.
Do not make the Cat with grayscale colours. Gray colours from black to white have saturation = 0.
If saturation = 0, it means the strength of the sprite color is 0. Then the sprite will not change color when you change its Color Effect.
- Discussion Forums
- » Help with Scripts
-
» How to code a color wheel/color picker?