Difference between revisions of "Color"
Jump to navigation
Jump to search
(Created page with "== Color == A Color represents a floating-point color with RGBA components. Colors can be added, subtracted, multiplied, and divided by other Colors, multiplied and divided b...") |
(→Color) |
||
Line 6: | Line 6: | ||
By default a Color is constructed as fully-opaque black (0, 0, 0, 1). | By default a Color is constructed as fully-opaque black (0, 0, 0, 1). | ||
+ | |||
+ | <source lang="python" enclose> | ||
+ | >> c = Color(1, 0, 0) | ||
+ | >> c = c * 2.0 | ||
+ | >> print c | ||
+ | Color(2.0,0.0,0.0,1.0) | ||
+ | </source> |
Revision as of 19:31, 18 November 2012
Color
A Color represents a floating-point color with RGBA components. Colors can be added, subtracted, multiplied, and divided by other Colors, multiplied and divided by scalars, and support the negative operator to invert the color values.
Individual components can be read or written using the r, g, b, and a attributes.
By default a Color is constructed as fully-opaque black (0, 0, 0, 1).
>> c = Color(1, 0, 0)
>> c = c * 2.0
>> print c
Color(2.0,0.0,0.0,1.0)