API Reference¶
- qdarktheme.load_stylesheet(theme: str = 'dark') str[source]¶
Load the style sheet which looks like flat design. There are two themes, dark theme and light theme.
- Parameters
theme – The name of the theme. Available theme are “dark” and “light”.
- Raises
TypeError – If the arg of theme name is wrong.
- Returns
The stylesheet string for the given theme.
Examples
Set stylesheet to your Qt application.
Dark Theme:
app = QApplication([]) app.setStyleSheet(qdarktheme.load_stylesheet()) # or app.setStyleSheet(qdarktheme.load_stylesheet("dark"))
Light Theme:
app = QApplication([]) app.setStyleSheet(qdarktheme.load_stylesheet("light"))
- qdarktheme.load_palette(theme: str = 'dark')[source]¶
Load the QPalette for the dark or light theme.
- Parameters
theme – The name of the theme. Available theme are “dark” and “light”.
- Raises
TypeError – If the arg name of theme is wrong.
- Returns
The QPalette for the given theme.
- Return type
QPalette
Examples
Set QPalette to your Qt application.
Dark Theme:
app = QApplication([]) app.setPalette(qdarktheme.load_palette()) # or app.setPalette(qdarktheme.load_palette("dark"))
Light Theme:
app = QApplication([]) app.setPalette(qdarktheme.load_palette("light"))