Skip to main content

Qt sass theme getter

Project description

qt-sass-theme-getter

Qt sass theme getter.

Default theme is dark-gray theme, my favorite.

Setup

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

Included Packages

Method Overview

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

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

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

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='light') # theme='dark'

    g.setThemeFiles(main_window=widget)

    widget.show()

    app.exec_()

Result

Light theme

image

Dark theme

image

Old Documentation (just walk it off)

Old Functions (potentially deprecated)

  • setTheme(theme='dark') - this method help people to easily set the theme. Currently (v0.0.25, 2022-05-31) this supports two theme - 'light', 'dark'. Theme is set to dark by default.

  • setThemeColor(bg_color, widget_color, text_color, hover_color, border_color, select_color, disabled_color, text_widget_color, scroll_handle_color) - in this case, you can set the theme color by yourself. Give 6-digit hex color string such as #FF0000.

    • bg_color - background color

    • widget_color - widget color

    • text_color - text color

    • hover_color - certain widgets' color when mouse cursor is hovering

    • border_color - color of widgets' border

    • select_color - selected widgets' color

    • disabled_color - disabled widgets' color

    • text_widget_color - background color of text widget such as QTextEdit/QTextBrowser

    • scroll_handle_color - horizontal/vertical QScrollBar's handle color

  • getThemeFiles(output_dir = os.getcwd()) - you can save css files in output_dir which were converted from .scss files included in this package.

  • getThemeStyle() -> str - use it to QMainWindow, QDialog.

  • getIconButtonStyle() -> str - use it to QPushButton/QToolButton which has icon.

  • getIconTextButtonStyle() -> str - use it to QPushButton/QToolButton.

  • getMenuBarStyle() -> str - use it to QMenuBar.

  • getMainWidgetStyle() -> str - use it to "top level" QWidget.

Old Example

Here's basic usage - get the style code and modify it(such as getThemeStyle() + QLineEdit { ... }), and set it to desired widget.

pyqt-dark-gray-theme/darkGrayTheme.py - return the dark-gray styles using qt-sass-theme-getter pacakge, even though dark-gray is default.

pyqt-style-setter/styleSetter.py - set the style of some widgets

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

qt-sass-theme-getter-0.0.28.tar.gz (9.5 kB view hashes)

Uploaded Source

Built Distribution

qt_sass_theme_getter-0.0.28-py3-none-any.whl (11.9 kB view hashes)

Uploaded Python 3

Supported by

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