Discuss Scratch

chickenandcheesesand
New Scratcher
5 posts

input colour

is it possible to ask the user to input a colour and then the sprite will change to that hex?
awesome-llama
Scratcher
1000+ posts

input colour

Not easily.
You could use the “ask and wait” block to ask the user to type in a color name or code.
The effect blocks provide some way of changing a sprite's color, notably the effects called “color”, “brightness”, and “ghost”. You might want to consider using multiple differently-colored costumes or pen to achieve the look you want.



Pen can be used like this, which is quite compatible with hex codes:

set pen color to [#e1d15a]

set [color 1 v] to [#e1d15a ]
set pen color to (color 1)

set [color 2 v] to [0xe1d15a]
set pen color to (color 2)

set [color 3 v] to [14799194] // converted to base 10
set pen color to (color 3)

Last edited by awesome-llama (Yesterday 17:06:29)

10goto10
Scratcher
1000+ posts

input colour

I’ve been interested in this project that shifts a costume’s color to an RGB color. https://scratch.mit.edu/projects/1258784246/

The trick is that the original costume color has to be red.

I modified it to show changing a sprite’s color to match one of the crayons in a 8 Crayola box. It just cycles through the colors but if you press space it will let you enter the name of the color and you can see how close the sprite changes to that color. Brown seems to be much too light but I don’t know why. https://scratch.mit.edu/projects/1258791928/

Of course other colors could be added to the list but you would need to search for the hex number that matches the colors. Finding hex numbers for crayola colors was easy.

chickenandcheesesand
New Scratcher
5 posts

input colour

i'm using the ‘ change colour effect by () ’ block, but i can't get other saturations or brightness.
10goto10
Scratcher
1000+ posts

input colour

Maybe if you shared your project and replied with a link we could help with spotting a problem.

chickenandcheesesand
New Scratcher
5 posts

input colour

https://scratch.mit.edu/projects/1255327190/


lol practically no-one has seen

simple code

Last edited by chickenandcheesesand (Yesterday 20:20:07)

10goto10
Scratcher
1000+ posts

input colour

I don’t see where your project uses the
Set [ brightness v] effect to (something)
Block

For example, if you wanted pink then this might work.
set [Color v] effect to (195)
set [brightness v] effect to (75)
chickenandcheesesand
New Scratcher
5 posts

input colour

i have used a
set [ color] effect to (thing)

but not a brightness one. i think that's what happened. thx

Last edited by chickenandcheesesand (Yesterday 20:40:58)

The_Cool_Test_Alt
Scratcher
100+ posts

input colour

10goto10 wrote:

Brown seems to be much too light but I don’t know why. https://scratch.mit.edu/projects/1258791928/
There's a reason why your brown is looking off. The original project said no S for a reason - it's not HSL, it's just HL, and while the rest of your colors are completely saturated anyway (or close enough that the difference is hard to see), brown is not.

I made a color picker once, and it required two costumes on top of each other - a red costume using ghost and color effects on top of either a black or white costume using either the ghost effect in front of the opposite-colored background, or the brightness effect (don't really remember).

There's a good chance you don't want your entire costume to be one color, so don't make it completely red. Just find the main section of your costume (preferably the one with highest saturation), and remember what the color is now (ignore the saturation and brightness). Then, set the color to zero, and reduce the color by that amount for every part of the costume. If you can't subtract by that amount, add 100 minus that amount instead. For the “white” costume, just make the saturation for all of them zero (I'd recommend using the brightness effect on this costume since your background won't necessarily be a solid white or black like mine). Repeat this process for any other costumes, and you have a colorable sprite!
chickenandcheesesand
New Scratcher
5 posts

input colour

ok. thx!

Last edited by chickenandcheesesand (Yesterday 21:25:15)

Powered by DjangoBB