Chapter 14.7. Working with Color

Color seems straightforward enough. You look up, and the sky is blue. You see a red car drive by. But, representing color with precision can be a tricky thing. MochiKit.Color is designed to help out with the different representations of color and also help with some common manipulations of color.

Colors can be represented by name (white), hue/saturation/lightness (0.0, 0.0, 1.0), red/green/blue (1.0, 1.0, 1.0), and as is common on the web, a hexadecimal representation of RGB (#ffffff). With all these different possible representations, MochiKit.Color provides a Color object that represents these in an abstract form, allowing you to create a color based on what you know and get back a representation that you need. ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.