Module turtle::color [] [src]

Color types and constants

When setting a color, you can use a variety of different color names. This module contains many of the most common colors that you might want to use. There is an even more comprehensive list in the extended module. Any of the color names listed in this module or in the extended module can be used as a color. You only need to reference the color::extended module if you want to use a specific color constant from that module.

You can refer to a color by using its color name as a string literal. For example:

// This will set the turtle's pen color to BLACK
turtle.set_pen_color("black");
// This is the same as the previous line
turtle.set_pen_color(color::BLACK);
// You can use any of the supported color names (including the ones from extended)
turtle.set_pen_color("deep lilac");

You can also use hex literals to get any color you want (even ones that aren't listed here).

turtle.set_pen_color("#3366ff");
turtle.set_pen_color("#36f");

Each color's constant name is in uppercase in the list below. The color name you should use to refer to it is in lower case next to the constant.

For your convenience, there are two static variables COLORS and COLOR_NAMES which contain the values of all the color constants and each of their names as strings. These static variables only contain the colors from this module. The extended module has its own static COLOR and COLOR_NAMES variables.

Modules

extended

Even more colors!!

Structs

Color

Constants

BEIGE
BLACK
BLUE
BROWN
CORAL
CYAN
GREEN
GREY
LAVENDER
LIME
MAGENTA
MAROON
MINT
NAVY
OLIVE
ORANGE
PINK
PURPLE
RED
TEAL
TRANSPARENT
WHITE
YELLOW

Statics

COLORS

A list of all of the colors

COLOR_NAMES

A list of all of the color names