pymel.core.general.colorIndex

colorIndex(*args, **kwargs)

The index specifies a color index in the color palette. The r, g, and b values (between 0-1) specify the RGB values (or the HSV values if the -hsv flag is used) for the color.

Flags:
Long name (short name) Argument Types Properties
hueSaturationValue (hsv) bool ../../../_images/create.gif ../../../_images/query.gif
 

Indicates that rgb values are really hsv values. Upon query, returns the HSV valuses as an array of 3 floats.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

resetToFactory (rf) bool ../../../_images/create.gif
 
Resets all color index palette entries to their factory defaults.
resetToSaved (rs) bool ../../../_images/create.gif
 
Resets all color palette entries to their saved values.

Derived from mel command maya.cmds.colorIndex

Example:

import pymel.core as pm

import maya.cmds as cmds

# Set the first entry in the color palette to have RGB values 1 0 0 - red.
pm.colorIndex( 1, 1, 0, 0 )
# Result: 1 #

# Set the first entry in the color palette to have HSV values 360 1 1 - red.
pm.colorIndex( 1, 360, 0, 0, hsv=True )
# Result: 1 #

# Return the RGB color values of the first entry of the color palette.
pm.colorIndex( 1, q=True )
# Result: [0.0, 0.0, 0.0] #

# Return the HSV color values of the first entry of the color palette.
pm.colorIndex( 1, q=True, hsv=True )
# Result: [0.0, 0.0, 0.0] #

Previous topic

pymel.core.general.color

Next topic

pymel.core.general.commandEcho

Core

Core Modules

Other Modules

This Page