Chapter 14.7.2. More Ways to Get a Color

In addition to the general Color.fromString, you can directly call functions for each form of color specification. These functions are as follows:

  • Color.fromHexString(hexString)

  • Color.fromHSL(hue, saturation, lightness, alpha=1.0)

  • Color.fromHSLString(hslString)

  • Color.fromHSV(hue, saturation, value, alpha=1.0)

  • Color.fromName(name) (W3C CSS3 color module name for the color. transparent is also accepted)

  • Color.fromRGB(red, green, blue, alpha=1.0)

  • Color.fromRGBString(rgbString)

MochiKit also has factories for a number of common colors:

  • Color.blackColor()

  • Color.blueColor()

  • Color.brownColor()

  • Color.cyanColor()

  • Color.darkGrayColor()

  • Color.grayColor()

  • Color.greenColor()

  • Color.lightGrayColor()

  • Color.magentaColor()

  • Color.orangeColor() ...

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.