You can get and set the internal values using different color representations such as RGB and L*a*b*.
Note that the constructor takes a single tuple of RGB values, not three arguments. So, for example, to create red you would say:
red = hou.Color((1.0, 0, 0))
You can set the color in one color space and get the color in a different color space to convert between spaces.
See HSL and HSV , Lab color space , CIE 1931 color space , and Color temperature for an introduction to the concepts the methods are based on.
Methods
__init__(rgb_tuple=(0.0, 0.0, 0.0))
→ Color
Creates a color object, optionally from RGB values.
To construct a color using a different representation, first create the object and then use a set
method:
c = hou.Color() c.setHSV(180, 0.5, 1.0)
rgb()
→ (float, float, float)
Returns the color as a tuple of (red, green, blue)
floating point values, where each value is in the range 0.0 to 1.0.
setRGB(tuple)
Sets the color using a tuple of (red, green, blue)
floating point values. See the rgb() method.
hsv()
→ (float, float, float)
Returns the color as a tuple of (hue, saturation, value)
, where hue is 0 - 360, and saturation and value are 0.0 - 1.0.
setHSV(tuple)
Sets the color as a tuple of (hue, saturation, value)
. See the hsv() method.
hsl()
→ (float, float, float)
Returns the color as a tuple of (hue, saturation, lightness)
, where hue is 0 - 360, and saturation and lightness are 0.0 - 1.0.
setHSL(tuple)
Sets the color as a tuple of (hue, saturation, lightness)
. See the hsl() method.
lab()
→ (float, float, float)
Returns the color as a tuple of (L, a, b)
as defined in the L*a*b* model, where L
is 0 - 100, and a
and b
are unbound. (Note that a
and b
are restricted to -128 - 127 in TIFF files).
setLAB(tuple)
Sets the color as a tuple of (L, a, b)
as defined in the L*a*b* model. See the lab() method.
tmi()
→ (float, float, float)
Returns the color as a tuple of (temperature, magenta, intensity)
, where each component is -1.0 to 1.0.
setTMI(tuple)
Sets the color as a tuple of (temperature, magenta, intensity)
. See the tmi() method.
xyz()
→ (float, float, float)
Returns the color as a tuple of (x, y, z)
"tristimulus" values, where each component is 0.0 to 1.0 (but may go out of bounds from conversion).
setXYZ(tuple)
Sets the color as a tuple of (x, y, z)
"tristimulus" values. See the xyz() method.
OpenColorIO
The following functions query the current OpenColorIO config. See OpenColorIO for more information.
reloadOCIO()
Reloads the OpenColorIO configuration file. This is generally paired with setting the OCIO environment variable to a new config file beforehand.
ocio_spaces()
Returns a list of the color spaces defined in the Open Color IO configuration in Houdini.
ocio_configPath()
→ str
Query the full path to the current OpenColorIO 'config.ocio' file.
ocio_activeDisplays()
→ tuple of str
Return the list of active Displays, specified in the config file or the OpenColorIO OCIO_ACTIVE_DISPLAYS environment variable.
ocio_activeViews()
→ tuple of str
Return the list of active Views, specified in the config file or the OpenColorIO OCIO_ACTIVE_VIEWS environment variable.
ocio_looks()
→ tuple of str
Return the list of Looks in the current OpenColorIO config.
ocio_roles()
→ tuple of str
Return the list of Roles in the current OpenColorIO config.
ocio_views(display)
→ tuple of str
Return the list of Views available for 'display'.
ocio_defaultDisplay()
→ str
Returns the default Display, specified in the config file or the OpenColorIO OCIO_ACTIVE_DISPLAYS environment variable (as the first Display in the list).
ocio_defaultView()
→ str
Returns the default View, specified in the config file or the OpenColorIO OCIO_ACTIVE_VIEWS environment variable (as the first View in the list).
Replaces |