Reading a Point's Color
-
Introduction
When you click on the color input, you can use the color picker tool to get the exact color value at any point you click.

You can actually do this using a block, which would allow your program to “scan” the stage automatically.
Description
To read the color value at any position on the stage, you can use this block:

X and Y Positions
The first 2 inputs are the X and Y positions of the point you would like to read. For example, if you want to know the color at the center point of the stage, then you should input 0 for both inputs.
Output Variables
Each type of color is actually represented by 4 numbers: color, brightness, saturation and transparency. Before you use this block, you need to first define 4 variables, and then select them in the 4 dropdowns of this block.
After you run this block, these 4 variables will contain the 4 numbers that represent a color.
Demo
As shown, we first manually read the brown color at the center of the stage using the color picker tool, which gives us these values: color = 9, saturation = 81, brightness = 60, transparency = 0.
Next, we use the “read color” block, which will store the same 4 numbers into the 4 variables: color = 9, saturation = 81, brightness = 60, transparency = 0.

Color Reader
Here is another demo project that reads the color of the point clicked by the mouse, and uses that color to draw a rectangle and print the color’s code.

Here is the project link:
https://play.creaticode.com/projects/65309f2a0fdce080a447a916
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login