Last active
February 16, 2017 02:50
-
-
Save whoiscarlo/cb869370c32732cf7214 to your computer and use it in GitHub Desktop.
Change Maya Window Color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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