Skip to main content

qt-sass-theme-getter

Set the Qt theme (e.g. dark/light/darkblue/lightblue) easily

This is using SCSS to set the light/dark theme to PyQt GUI, which is quite efficient.

Setup

python -m pip install qt-sass-theme-getter

Included Packages

Method Overview

getThemeFiles(theme: str = 'dark', output_path=os.getcwd())

Supporting theme:

  • dark

  • dark_blue

  • light

  • light_blue

Theme files will be saved in 'res' directory of output_path after you called getThemeFiles.

'res' directory looks like this:

image

ico directory holds icon files which will be being used in theme. For example, light icons will be being used in dark theme, dark icons will be being used in light theme. _icons.scss makes sass files in sass directory refer to icons in this directory.

sass directory holds the scss files which will be converted into css files.

var directory holds the _variables.scss which contains the color(e.g. color of background/widget/border...) variables. You can change the _variables.scss's variables whatever you want, if you want to set custom variables.


setThemeFiles(main_window: QWidget, input_path='res', exclude_type_lst: list = [])

Right after calling getThemeFiles, you can set the style with calling setThemeFiles.

After calling it, 'res' directory looks like this:

image

scss files successfully convert into css files.

Note: Don't change the current directory with function such as os.chdir after calling getThemeFiles and before calling setThemeFiles. FileNotFoundError will be most likely occurred.

Example

Code Sample

from PyQt5.QtWidgets import QApplication

from pyqt_timer.settingsDialog import SettingsDialog

from qt_sass_theme_getter import QtSassThemeGetter





if __name__ == "__main__":

    import sys



    app = QApplication(sys.argv)

    widget = SettingsDialog()

    g = QtSassThemeGetter()

    g.getThemeFiles(theme='dark')

    # g.getThemeFiles(theme='dark_blue') - if you want to set dark blue theme

    g.setThemeFiles(main_window=widget)

    widget.show()

    app.exec_()

Result

Dark theme

image

Dark blue theme

image

Light theme

image

Light blue theme

image

Metadata

Release files for qt-sass-theme-getter 0.0.33

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qt-sass-theme-getter 0.0.33
File Size Uploaded
qt-sass-theme-getter-0.0.33.tar.gz 9.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qt-sass-theme-getter 0.0.33
File Interpreter ABI Platform
qt_sass_theme_getter-0.0.33-py3-none-any.whl Python 3 none any Details

Total release size: 25.8 kB

Release files / qt-sass-theme-getter-0.0.33.tar.gz

Download URL qt-sass-theme-getter-0.0.33.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a634cfbe63ca8fe9269b4996c49ee5c9aabfe1a216151ab44152caf08f7dae97
BLAKE2b-256 checksum
How to use checksums
acad1d6c4c2edf231333f6a313a59470b2472c2482533f023790e97f7576add5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/0.0.0 CPython/3.7.6

Release files / qt_sass_theme_getter-0.0.33-py3-none-any.whl

Download URL qt_sass_theme_getter-0.0.33-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3d0a38ed01f432e9c43489043035d4862b3d806bd45a63a9af7157207f44b40
BLAKE2b-256 checksum
How to use checksums
02ced7919e929793255b09647d43359fd1024dd164982289b26fa9e30c327c58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/0.0.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.33 This release

2 release files

0.0.25

2 release files

0.0.24

2 release files

0.0.23

2 release files

0.0.22

2 release files

0.0.21

2 release files

0.0.20

2 release files

0.0.19

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page