Color

Extension for encoding colors as integers from a set of Red Green Blue (RGB) or Hue Saturation Brightness (HSB) values.

Please note that red, green and blue are three colors are primary colors of light. They are different from the primary colors of pigments: red, yellow blue, which mix differently. Please see this article on color mixing for more information.

Every color that can be displayed on your computer is represented by a number between 0 to 16,777,215. These blocks will let you easily calculate the number that you want based on the RGB or HSB color model.

Example
set pen color to color r        255 g         248 b         231 With this script, you can set the pen color to a specific an RGB value. Note that the "set pen color to" block is the one that works with the dropper tool

RGB (Red Green Blue)
The RGB color model is based on the human perception of colors. The typical human eye detects red green and blue light, while all other colors are by a mixing these colors.

Computers typically display these values changing the intensity of these colors for each pixel on the screen. These intensities are represented by numbers form 0 to 256.

HSB (Hue Saturation Brightness)
The HSB color model may be a more intuitive way to represent colors with numbers. A hue value represents the a perceived color as particular ratio of red, green and/or blue values, using a number between 0 and 360. The following table may be used as a reference to determine the perceived color form a hue value. Hue value that lie in between these constants represent a mixture of colors. Saturation represents the intensity of a color. Higher values represent a more colorful value, while lower ones represent a grayer one. A saturation 0% will always result in a shade of white, gray or black depending on the brightness value regardless of hue.

Brightness represents the brightness of a color. Higher values will result in a brighter color, while lower ones result in a darker color. A brightness of 0% will always result in black, regardless of hue and brightness.

HSL (Hue Saturation Lightness)
The HSL color model is currently not supported by this library.

Blocks
† Red, green and blue values will be constrained to the range of values between 0 and 255. Values less than 0 will be interpreted as 0, while values greater than 255 will be interpreted as 255.

†† Saturation and brightness values will be constrained to values between 0 and 100, while HUE values outside of the range 0-360 will wrap around by dividing the value by 360 and using the remainder. For example, 390 and 30 represent the same hue.