# PyQtDarkTheme
PyQtDarkTheme applies a flat dark theme to QtWidgets application(PySide and PyQt). There's a light theme too. Color and style balanced from a dark theme for easy viewing in daylight.
Check out the [complete documentation](https://pyqtdarktheme.readthedocs.io).
**Project status**
[![PyPI Latest Release](https://img.shields.io/pypi/v/pyqtdarktheme.svg?color=orange)](https://pypi.org/project/pyqtdarktheme/)
[![Python Versions](https://img.shields.io/pypi/pyversions/pyqtdarktheme.svg?color=blue)](https://www.python.org/downloads/)
[![Qt Versions](https://img.shields.io/badge/Qt-5%20|%206-blue.svg?&logo=Qt&logoWidth=18&logoColor=white)](https://www.qt.io/qt-for-python)
[![License](https://img.shields.io/github/license/5yutan5/PyQtDarkTheme.svg?color=green)](https://github.com/5yutan5/PyQtDarkTheme/blob/main/LICENSE.txt/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-black.svg)](https://github.com/python/black)
**Tests**
[![tests](https://github.com/5yutan5/PyQtDarkTheme/actions/workflows/test.yml/badge.svg)](https://github.com/5yutan5/PyQtDarkTheme/actions/workflows/test.yml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/5yutan5/PyQtDarkTheme/main.svg)](https://results.pre-commit.ci/latest/github/5yutan5/PyQtDarkTheme/main)
[![codecov](https://codecov.io/gh/5yutan5/PyQtDarkTheme/branch/main/graph/badge.svg?token=RTS8O0V6SF)](https://codecov.io/gh/5yutan5/PyQtDarkTheme)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/5yutan5/PyQtDarkTheme.svg?logo=lgtm&logoWidth=18&color=success)](https://lgtm.com/projects/g/5yutan5/PyQtDarkTheme/alerts/)
[![Documentation Status](https://readthedocs.org/projects/pyqtdarktheme/badge/?version=latest)](https://pyqtdarktheme.readthedocs.io/en/latest/?badge=latest)
## Features
- A flat dark and light theme
- Support PySide and PyQt
- Support PyInstaller
- Resolve the style differences between Qt versions
- QPalette of dark and light theme
## Themes
### Dark Theme
![widget_gallery_dark_theme](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/widget_gallery_dark.png)
### Light Theme
![widget_gallery_light_them](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/widget_gallery_light.png)
## Requirements
- [Python 3.7+](https://www.python.org/downloads/)
- Qt 5.11+
- PySide6, PyQt6, PyQt5 or PySide2
## Installation Method
- Last released version
```plaintext
pip install pyqtdarktheme
```
- Latest development version
```plaintext
pip install git+https://github.com/5yutan5/PyQtDarkTheme.git@main
```
## Usage
```Python
import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
import qdarktheme
app = QApplication(sys.argv)
main_win = QMainWindow()
push_button = QPushButton("PyQtDarkTheme!!")
main_win.setCentralWidget(push_button)
# Apply dark theme to Qt application
app.setStyleSheet(qdarktheme.load_stylesheet())
main_win.show()
app.exec()
```
> ⚠ The image quality may be lower on Qt5(PyQt5, PySide2) due to the use of svg. You can add the following attribute to improve the quality of images.
>
> ```Python
> app.setAttribute(Qt.ApplicationAttribute.AA_UseHighDpiPixmaps)
> ```
### Light theme
```Python
app.setStyleSheet(qdarktheme.load_stylesheet("light"))
```
### Dark and Light palette
You can get color of dark and light theme by loading QPalette.
To load palette, run:
```Python
palette = qdarktheme.load_palette()
# or
palette = qdarktheme.load_palette("light")
```
For example, you can apply a link color to your application.
```Python
import sys
from PyQt5.QtGui import QPalette
from PyQt5.QtWidgets import QApplication
import qdarktheme
app = QApplication(sys.argv)
dark_palette = qdarktheme.load_palette()
palette = app.palette()
palette.setColor(QPalette.ColorRole.Link, dark_palette.link().color())
app.setPalette(palette)
```
Further information can be found in our docs:
- [Usage Guide](https://pyqtdarktheme.readthedocs.io/en/latest/how_to_use.html)
### Sharp frame
You can change the border corner style.
```python
# Default is "rounded".
stylesheet = qdarktheme.load_stylesheet(border="sharp")
```
![widget_gallery_dark_theme_sharp](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/widget_gallery_dark_sharp.png)
## Example
To check example app, run:
```plaintext
python -m qdarktheme.widget_gallery
```
## License
The svg files for the PyQtDarkTheme are derived [Material design icons](https://fonts.google.com/icons)(Apache License Version 2.0). Qt stylesheets are originally fork of [QDarkStyleSheet](https://github.com/ColinDuquesnoy/QDarkStyleSheet)(MIT License). Other files are covered by PyQtDarkTheme's MIT license.
## Contributing
All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome. You can get started by reading this:
- [Contributing Guide](https://pyqtdarktheme.readthedocs.io/en/latest/contributing.html)
## Change log
See [Releases](https://github.com/5yutan5/PyQtDarkTheme/releases).
Raw data
{
"_id": null,
"home_page": "https://github.com/kevinjohncutler/omnipose-theme",
"name": "omnipose-theme",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "qt, stylesheets, dark-theme",
"author": "Yunosuke Ohsugi",
"author_email": "63651161+5yutan5@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/49/aa/26b8718e4ad004a389141c15498e847a30f98090e3cd2da4022a05e0a70f/omnipose_theme-1.1.3.tar.gz",
"platform": null,
"description": "# PyQtDarkTheme\n\nPyQtDarkTheme applies a flat dark theme to QtWidgets application(PySide and PyQt). There's a light theme too. Color and style balanced from a dark theme for easy viewing in daylight.\n\nCheck out the [complete documentation](https://pyqtdarktheme.readthedocs.io).\n\n**Project status** \n[![PyPI Latest Release](https://img.shields.io/pypi/v/pyqtdarktheme.svg?color=orange)](https://pypi.org/project/pyqtdarktheme/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/pyqtdarktheme.svg?color=blue)](https://www.python.org/downloads/)\n[![Qt Versions](https://img.shields.io/badge/Qt-5%20|%206-blue.svg?&logo=Qt&logoWidth=18&logoColor=white)](https://www.qt.io/qt-for-python)\n[![License](https://img.shields.io/github/license/5yutan5/PyQtDarkTheme.svg?color=green)](https://github.com/5yutan5/PyQtDarkTheme/blob/main/LICENSE.txt/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-black.svg)](https://github.com/python/black)\n\n**Tests** \n[![tests](https://github.com/5yutan5/PyQtDarkTheme/actions/workflows/test.yml/badge.svg)](https://github.com/5yutan5/PyQtDarkTheme/actions/workflows/test.yml)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/5yutan5/PyQtDarkTheme/main.svg)](https://results.pre-commit.ci/latest/github/5yutan5/PyQtDarkTheme/main)\n[![codecov](https://codecov.io/gh/5yutan5/PyQtDarkTheme/branch/main/graph/badge.svg?token=RTS8O0V6SF)](https://codecov.io/gh/5yutan5/PyQtDarkTheme)\n[![Total alerts](https://img.shields.io/lgtm/alerts/g/5yutan5/PyQtDarkTheme.svg?logo=lgtm&logoWidth=18&color=success)](https://lgtm.com/projects/g/5yutan5/PyQtDarkTheme/alerts/)\n[![Documentation Status](https://readthedocs.org/projects/pyqtdarktheme/badge/?version=latest)](https://pyqtdarktheme.readthedocs.io/en/latest/?badge=latest)\n\n## Features\n\n- A flat dark and light theme\n- Support PySide and PyQt\n- Support PyInstaller\n- Resolve the style differences between Qt versions\n- QPalette of dark and light theme\n\n## Themes\n\n### Dark Theme\n\n![widget_gallery_dark_theme](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/widget_gallery_dark.png)\n\n### Light Theme\n\n![widget_gallery_light_them](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/widget_gallery_light.png)\n\n## Requirements\n\n- [Python 3.7+](https://www.python.org/downloads/)\n- Qt 5.11+\n- PySide6, PyQt6, PyQt5 or PySide2\n\n## Installation Method\n\n- Last released version\n\n ```plaintext\n pip install pyqtdarktheme\n ```\n\n- Latest development version\n\n ```plaintext\n pip install git+https://github.com/5yutan5/PyQtDarkTheme.git@main\n ```\n\n## Usage\n\n```Python\nimport sys\n\nfrom PySide6.QtWidgets import QApplication, QMainWindow, QPushButton\n\nimport qdarktheme\n\napp = QApplication(sys.argv)\nmain_win = QMainWindow()\npush_button = QPushButton(\"PyQtDarkTheme!!\")\nmain_win.setCentralWidget(push_button)\n\n# Apply dark theme to Qt application\napp.setStyleSheet(qdarktheme.load_stylesheet())\n\nmain_win.show()\n\napp.exec()\n\n```\n\n> \u26a0 The image quality may be lower on Qt5(PyQt5, PySide2) due to the use of svg. You can add the following attribute to improve the quality of images.\n>\n> ```Python\n> app.setAttribute(Qt.ApplicationAttribute.AA_UseHighDpiPixmaps)\n> ```\n\n### Light theme\n\n```Python\napp.setStyleSheet(qdarktheme.load_stylesheet(\"light\"))\n```\n\n### Dark and Light palette\n\nYou can get color of dark and light theme by loading QPalette.\nTo load palette, run:\n\n```Python\npalette = qdarktheme.load_palette()\n# or\npalette = qdarktheme.load_palette(\"light\")\n```\n\nFor example, you can apply a link color to your application.\n\n```Python\nimport sys\n\nfrom PyQt5.QtGui import QPalette\nfrom PyQt5.QtWidgets import QApplication\n\nimport qdarktheme\n\napp = QApplication(sys.argv)\ndark_palette = qdarktheme.load_palette()\npalette = app.palette()\npalette.setColor(QPalette.ColorRole.Link, dark_palette.link().color())\napp.setPalette(palette)\n\n```\n\nFurther information can be found in our docs:\n\n- [Usage Guide](https://pyqtdarktheme.readthedocs.io/en/latest/how_to_use.html)\n\n### Sharp frame\n\nYou can change the border corner style.\n\n```python\n# Default is \"rounded\".\nstylesheet = qdarktheme.load_stylesheet(border=\"sharp\")\n```\n\n![widget_gallery_dark_theme_sharp](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/widget_gallery_dark_sharp.png)\n\n## Example\n\nTo check example app, run:\n\n```plaintext\npython -m qdarktheme.widget_gallery\n```\n\n## License\n\nThe svg files for the PyQtDarkTheme are derived [Material design icons](https://fonts.google.com/icons)(Apache License Version 2.0). Qt stylesheets are originally fork of [QDarkStyleSheet](https://github.com/ColinDuquesnoy/QDarkStyleSheet)(MIT License). Other files are covered by PyQtDarkTheme's MIT license.\n\n## Contributing\n\nAll contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome. You can get started by reading this:\n\n- [Contributing Guide](https://pyqtdarktheme.readthedocs.io/en/latest/contributing.html)\n\n## Change log\n\nSee [Releases](https://github.com/5yutan5/PyQtDarkTheme/releases).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "True gray variant of pyqtdarktheme for the Omnipose GUI.",
"version": "1.1.3",
"project_urls": {
"Documentation": "https://pyqtdarktheme.readthedocs.io",
"Homepage": "https://github.com/kevinjohncutler/omnipose-theme",
"Repository": "https://github.com/kevinjohncutler/omnipose-theme"
},
"split_keywords": [
"qt",
" stylesheets",
" dark-theme"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "427da0e98b8d23b833d13635cdf78b4dd22077dca872bd57ba8476d9e55cd8dd",
"md5": "0b6e4b01970ba83a4f7029706334ce6c",
"sha256": "02ba540bffbac92831330a187585bf67d5ed332839ff2ee6efeff54c6f1c3d75"
},
"downloads": -1,
"filename": "omnipose_theme-1.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0b6e4b01970ba83a4f7029706334ce6c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 43418,
"upload_time": "2024-06-06T01:43:02",
"upload_time_iso_8601": "2024-06-06T01:43:02.310549Z",
"url": "https://files.pythonhosted.org/packages/42/7d/a0e98b8d23b833d13635cdf78b4dd22077dca872bd57ba8476d9e55cd8dd/omnipose_theme-1.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "49aa26b8718e4ad004a389141c15498e847a30f98090e3cd2da4022a05e0a70f",
"md5": "2c6f8e9af4de9ba4cc9874374db1e643",
"sha256": "eabdca1b9c87f5dfbbd385d26d948f3ffe737bac168e7b85944a3bb81a9bb294"
},
"downloads": -1,
"filename": "omnipose_theme-1.1.3.tar.gz",
"has_sig": false,
"md5_digest": "2c6f8e9af4de9ba4cc9874374db1e643",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 35506,
"upload_time": "2024-06-06T01:43:03",
"upload_time_iso_8601": "2024-06-06T01:43:03.963667Z",
"url": "https://files.pythonhosted.org/packages/49/aa/26b8718e4ad004a389141c15498e847a30f98090e3cd2da4022a05e0a70f/omnipose_theme-1.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-06 01:43:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kevinjohncutler",
"github_project": "omnipose-theme",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "omnipose-theme"
}