TheOtherTD
3/21/2015 - 4:11 AM

Change Maya Window Color

Change Maya Window Color

def changeMayaWindowColor(color=None):
	"""
	Colorize Maya background
	"""
	if not color:
		randColor = random.randint(0, 128)
		if 60< randColor > 75:
			randColor = 80
		randIndex = random.randint(0, 2)
		colors = [50, 60, 65]

		color = '#%02x%02x%02x' %(colors[0], colors[1], colors[2])

	## Set a style sheet to color the main window and QWidgets
	## (but not QWidget subclasses)
	styleSheetItems = ['QMainWindow', '.QWidget', 'QMenuItem']
	styleSheet = ''
	for item in styleSheetItems:
		styleSheet += '%s{background-color: %s;}'%(item, color)

	app = QtGui.QApplication.instance()
	app.setStyleSheet(styleSheet)