Skip to content

Instantly share code, notes, and snippets.

@whoiscarlo
Last active February 16, 2017 02:50
Show Gist options
  • Save whoiscarlo/cb869370c32732cf7214 to your computer and use it in GitHub Desktop.
Save whoiscarlo/cb869370c32732cf7214 to your computer and use it in GitHub Desktop.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment