XML style for custom layout

For regular Qt layouts, you change change background color of a widget using xml or python

<property name="styleSheet">
 <string>background-color:#000000</string>
</property>
widget=qt.QWidget()
widget.setStyleSheet("background-color:#000000")   # background set to black

I generally use Qt Designer to generate UI files which is the XML code. That application is actually bundled in Slicer 4.10.1 which you can access by going to …/Slicer 4.10.1/bin/SlicerDesigner.exe or you can use it if you download Qt5 from the web.

Slicer does technically have a “Dark Mode” if you are attempting to set layouts to some dark color. You can switch to it by going to Edit->Application Settings->Appearance->Style->Dark Slicer

1 Like