That's awesome Tony, thanks! I wonder how the person who came up with this extracted the data though.
Regards, Fredrik On Tue, Mar 10, 2015 at 6:23 PM Tony Barbieri <[email protected]> wrote: > Hey Fredrik, > > I believe Maya is actually using an Application wide QPalette and the > QApplication is using the "Plastique" style. The following code I took > from elsewhere but hopefully you get the general idea. > > base_palette = QtGui.QPalette() > > HIGHLIGHT_COLOR = QtGui.QColor(103, 141, 178) > BRIGHTNESS_SPREAD = 2.5 > > BRIGHT_COLOR = QtGui.QColor(200, 200, 200) > LIGHT_COLOR = QtGui.QColor(100, 100, 100) > DARK_COLOR = QtGui.QColor(42, 42, 42) > MID_COLOR = QtGui.QColor(68, 68, 68) > MID_LIGHT_COLOR = QtGui.QColor(84, 84, 84) > SHADOW_COLOR = QtGui.QColor(21, 21, 21) > > BASE_COLOR = MID_COLOR > TEXT_COLOR = BRIGHT_COLOR > DISABLED_BUTTON_COLOR = QtGui.QColor(78, 78, 78) > DISABLED_TEXT_COLOR = QtGui.QColor(128, 128, 128) > ALTERNATE_BASE_COLOR = QtGui.QColor(46, 46, 46) > if self.lightness(BASE_COLOR) > 0.5: > SPREAD = 100 / BRIGHTNESS_SPREADelse: > SPREAD = 100 * BRIGHTNESS_SPREAD > if self.lightness(HIGHLIGHT_COLOR) > 0.6: > HIGHLIGHTEDTEXT_COLOR= BASE_COLOR.darker(SPREAD*2)else: > HIGHLIGHTEDTEXT_COLOR= BASE_COLOR.lighter(SPREAD*2) > > base_palette.setBrush(QtGui.QPalette.Window, QtGui.QBrush(MID_COLOR)) > base_palette.setBrush(QtGui.QPalette.WindowText, QtGui.QBrush(TEXT_COLOR)) > base_palette.setBrush(QtGui.QPalette.Foreground, QtGui.QBrush(BRIGHT_COLOR)) > base_palette.setBrush(QtGui.QPalette.Base, QtGui.QBrush(DARK_COLOR)) > base_palette.setBrush(QtGui.QPalette.AlternateBase, > QtGui.QBrush(ALTERNATE_BASE_COLOR)) > base_palette.setBrush(QtGui.QPalette.ToolTipBase, QtGui.QBrush(BASE_COLOR)) > base_palette.setBrush(QtGui.QPalette.ToolTipText, QtGui.QBrush(TEXT_COLOR)) > > base_palette.setBrush(QtGui.QPalette.Text, QtGui.QBrush(TEXT_COLOR)) > base_palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, > QtGui.QBrush(DISABLED_TEXT_COLOR)) > > base_palette.setBrush(QtGui.QPalette.Button, QtGui.QBrush(LIGHT_COLOR)) > base_palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, > QtGui.QBrush(DISABLED_BUTTON_COLOR)) > base_palette.setBrush(QtGui.QPalette.ButtonText, QtGui.QBrush(TEXT_COLOR)) > base_palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, > QtGui.QBrush(DISABLED_TEXT_COLOR)) > base_palette.setBrush(QtGui.QPalette.BrightText, QtGui.QBrush(TEXT_COLOR)) > base_palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, > QtGui.QBrush(DISABLED_TEXT_COLOR)) > > base_palette.setBrush(QtGui.QPalette.Light, QtGui.QBrush(LIGHT_COLOR)) > base_palette.setBrush(QtGui.QPalette.Midlight, QtGui.QBrush(MID_LIGHT_COLOR)) > base_palette.setBrush(QtGui.QPalette.Mid, QtGui.QBrush(MID_COLOR)) > base_palette.setBrush(QtGui.QPalette.Dark, QtGui.QBrush(DARK_COLOR)) > base_palette.setBrush(QtGui.QPalette.Shadow, QtGui.QBrush(SHADOW_COLOR)) > > base_palette.setBrush(QtGui.QPalette.Highlight, QtGui.QBrush(HIGHLIGHT_COLOR)) > base_palette.setBrush(QtGui.QPalette.HighlightedText, > QtGui.QBrush(HIGHLIGHTEDTEXT_COLOR)) > # Setup additional palettes for QTabBar and QTabWidget to look more like# > maya. > tab_palette = QtGui.QPalette(base_palette) > tab_palette.setBrush(QtGui.QPalette.Window, QtGui.QBrush(LIGHT_COLOR)) > tab_palette.setBrush(QtGui.QPalette.Button, QtGui.QBrush(MID_COLOR)) > > widget_palettes = {} > widget_palettes["QTabBar"] = tab_palette > widget_palettes["QTabWidget"] = tab_palette > > QtGui.QApplication.setStyle("Plastique") > QtGui.QApplication.setPalette(base_palette)for name, palette in > widget_palettes.items(): > QtGui.QApplication.setPalette(palette, name) > > > > On Tue, Mar 10, 2015 at 12:49 PM, Fredrik Averpil < > [email protected]> wrote: > >> Getting closer ... (?) >> >> from PySide.QtGui import QApplication >> app = QApplicationprint app.style().metaObject().className() >> >> QadskDarkStyle >> >> >> >> Hm, I wonder if I can somehow extract the CSS from this. >> >> // Fredrik >> >> >> On Tue, Mar 10, 2015 at 5:35 PM Fredrik Averpil < >> [email protected]> wrote: >> >>> No, I haven't. >>> To be honest, I'm trying to snatch the complete stylesheet from Maya (if >>> at all possible) to use that look in one of my UIs which runs outside of >>> Maya. >>> >>> But it seems maybe this is not possible at all. >>> >>> // Fredrik >>> >>> >>> On Tue, Mar 10, 2015 at 5:29 PM Marcus Ottosson <[email protected]> >>> wrote: >>> >>>> Fetch the stylesheet? I don't think there is such a thing. The >>>> stylesheet you put into Qt is immediately parsed into native attributes and >>>> then discarded. >>>> >>>> Have you managed this in previous versions of Maya? >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Python Programming for Autodesk Maya" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit https://groups.google.com/d/ >>>> msgid/python_inside_maya/CAFRtmOCrRyiYT_kAb_fJ1BjFDP2qkVjyZYbgbn% >>>> 2BYQnajcMhLPA%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCrRyiYT_kAb_fJ1BjFDP2qkVjyZYbgbn%2BYQnajcMhLPA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWPyozxHyjruv7_k8cx-EufpkuJyGVQ5LO1h0KkKbv548w%40mail.gmail.com >> <https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWPyozxHyjruv7_k8cx-EufpkuJyGVQ5LO1h0KkKbv548w%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . > > >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Tony > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAJhmvsTNOYjtCLDQ-tR4MD_H3%3Dat%2BqwiKWMwN%3DxfwMze41NhUQ%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAJhmvsTNOYjtCLDQ-tR4MD_H3%3Dat%2BqwiKWMwN%3DxfwMze41NhUQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWPrDckN5NDQrA6zMxS%3DA3TE8-_16iMmOSbzxc2hPmiYgw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
