gewel.color
This module contains code related to colors.
Many of the objects gewel can render can be
rendered in a variety of colors. There are two
main classes of color that you are likely to
use, gewel.color.Color and
gewel.color.ColorMap,
both of which derive from the abstract base class
gewel.color.BaseColor.
In many cases, you will not explicitly construct objects of these classes, but rather use existing color objects that are already defined for you. For example:
import gewel.color as color
my_color = color.RED
my_other_color = color.DARK_GREY
my_drawable.line_color = color.PURPLE
Of course, you can also create your own custom colors. For example:
import gewel.color as color
my_favorite_color = color.Color(0.6235, 0.8863, 0.7490)
dark_shadow_color = color.Color(0.75, 0.75, 0.75, 0.25)
In the first case, my_favorite_color, we
created a custom color by specifying the relative amounts of
red, green, and blue on a scale of 0.0 (none of the color) to 1.0
(the maximum amount).
In the second case, dark_shadow_color, we
added an optional fourth
argument to specify the alpha of the color.
The alpha indicates how transparent the color
should be. 0.0 means completely transparent. 1.0 means
completely opaque. Leaving it out as we did
in my_favorite_color is equivalent to passing
in the default value of 1.0.
Module attributes
This is a completely transparent color. |
|
White |
|
Light Gray |
|
Gray |
|
Dark Gray |
|
Black |
|
Red |
|
Green |
|
Blue |
|
Cyan |
|
Magenta |
|
Yellow |
|
Maroon |
|
Dark Green |
|
Navy |
|
Teal |
|
Purple |
|
Olive |
|
Orange |
|
Pink |
|
This is a neutral color suitable for use as a background in a variety of settings. |
Functions
Classes
The abstract base class for colors. |
|
A color with three components red, green, and blue representing the relative level or red, green, and blue respectively, and alpha fourth component alpha (alpha) representing opacity. |
|
A color map is a color that is derived from other colors. |