Go to: Synopsis. Return value. Flags. Python examples.

Synopsis

grabColor([hsvValue=boolean], [rgbValue=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

grabColor is undoable, NOT queryable, and NOT editable.

This command changes the cursor and enters a modal state which will be exited by pressing a mouse button. The color component values of the pixel below the cursor at the time of the button press are returned.

Return value

float[]

Three float values representing the color components of the pixel below the cursor. If no flags are specified then the default is to return the red, green and blue color components.

Flags

hsvValue, rgbValue
Long name (short name) Argument types Properties
hsvValue(hsv) boolean create
The 3 returned float values will specify the hue, saturation and value color components.
rgbValue(rgb) boolean create
The 3 returned float values will specify the red, green and blue color components.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

cmds.grabColor()
cmds.grabColor( hsv=True )
color = cmds.grabColor()