Skip to main content

Qt theme in pure qss

Project description

Qt Theme

Qt theme in pure qss - 纯 qss 的 Qt 主题

Preview and Export Resource Package Online - 在线预览和导出资源包

dark

light

Usage

Install by pip install QtTheme then:

# import resource
import QtTheme.PySide6 as QtTheme
# import QtTheme.PySide2 as QtTheme
# import QtTheme.PyQt6 as QtTheme
# import QtTheme.PyQt5 as QtTheme

# set style sheet of the root widget
mainwindow.setStyleSheet(QtTheme.getThemeStyle('Flat', 'Dark', 'Blue', 'Pink'))

# set color of widgets
button.setProperty("Color", "Primary")

Alternatively, without installing QtTheme, you can export a single-style qrc resource package through the online website. Use RCC to add it to your project.

pyside6-rcc -o resource.py QtTheme.qrc
# import resource
import resource

# open qss file
qss = QFile(":/QtTheme/theme/Flat/Dark/Blue/Pink.qss")
qss.open(QFile.OpenModeFlag.ReadOnly)

# set style sheet of the root widget
mainwindow.setStyleSheet(qss.readAll().data().decode())

# set color of widgets
button.setProperty("Color", "Primary")

API

Use QWidget.setProperty to set color of widget:

QWidget.setProperty("Color", "XXX")
Color Explain
Primary The primary color selected when exporting
Secondary The secondary color selected when exporting
Success The success color(GREEN)
Warning The warning color(ORANGE)
Danger The error color(RED)

To get themes:

def getThemes(): ...

def getBaseColors(theme:str): ...

def getPrimaryColors(theme:str, base:str): ...

def getSecondaryColors(theme:str, base:str, primary:str): ...

def getThemeStyle(theme:str, base:str, primary:str, secondary:str): ...

Tips

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qttheme-1.0.2.tar.gz (34.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qttheme-1.0.2-py3-none-any.whl (36.3 MB view details)

Uploaded Python 3

File details

Details for the file qttheme-1.0.2.tar.gz.

File metadata

  • Download URL: qttheme-1.0.2.tar.gz
  • Upload date:
  • Size: 34.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for qttheme-1.0.2.tar.gz
Algorithm Hash digest
SHA256 2415ff62fe9314e373f69275163e147c32b89824a900a9e839e0efe3e6c24ffb
MD5 6abf28a5c5d883b2a98c3d86e55e9d26
BLAKE2b-256 64268e71888bdb707a9556a53c72a3a1b795c662fec106c6e51506a8f23e8b6c

See more details on using hashes here.

File details

Details for the file qttheme-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: qttheme-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 36.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for qttheme-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 918bdada36647b062e987183d240b3ad25daa945f91cd6b6e66098053e0625be
MD5 2723b60b50d304009356d58fadcf8eae
BLAKE2b-256 2a3c118d3312565a91dc78d7be862bc2a80df70cd8c9f556451a2faa0eee26fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page