3D slicer python console

Can I convert the color to grayscale with code on the 3D slicer Python console?