# PyQtDarkTheme
PyQtDarkTheme applies a flat dark theme to QtWidgets application. There's a light theme too. Color balanced from the 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/)
**Tests**
[![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)
[![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
- Sync with OS's theme and accent (Mac, Windows, Linux)
- Resolve the style differences between Qt versions
- Provide dark/light theme QPalette
- Override Qt old standard icons
## 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.15+
- 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)
# Apply the complete dark theme to your Qt App.
qdarktheme.setup_theme()
main_win = QMainWindow()
push_button = QPushButton("PyQtDarkTheme!!")
main_win.setCentralWidget(push_button)
main_win.show()
app.exec()
```
Further information can be found in our docs:
- [Usage Guide](https://pyqtdarktheme.readthedocs.io/en/latest/how_to_use.html)
### Enable HiDPI
```Python
# enable_hi_dpi() must be called before the instantiation of QApplication.
qdarktheme.enable_hi_dpi()
app = QApplication(sys.argv)
qdarktheme.setup_theme()
```
For Qt6 bindings, HiDPI “just works” without using this function.
### Light theme
```Python
qdarktheme.setup_theme("light")
```
### Sync with OS's theme and accent
```Python
qdarktheme.setup_theme("auto")
```
![sync with os theme](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/sync_with_os_theme.gif)
On macOS, qdarktheme also syncs with accent colors.
![sync with os accent](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/sync_with_os_accent.gif)
### Customizing colors
You can customize the theme color.
```python
# Customize accent color.
qdarktheme.setup_theme(custom_colors={"primary": "#D0BCFF"})
```
For a list of all customizable colors, see the Theme Color Reference:
- [Theme Color](https://pyqtdarktheme.readthedocs.io/en/latest/reference/theme_color.html)
### Sharp frame
You can change the corner style.
```python
# Default is "rounded".
stylesheet = qdarktheme.setup_theme(corner_shape="sharp")
```
### QPalette and stylesheet
You can also only load QPalette and stylesheet. `qdarktheme.setup_theme` uses the following functions internally.
```Python
palette = qdarktheme.load_palette(theme="dark")
stylesheet = qdarktheme.load_stylesheet(theme="dark")
```
## Example
To check all Qt widgets, 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. The accent detector(qdarktheme/_os_appearance/_accent/_mac_detect) is inspired by [darkdetect](https://github.com/albertosottile/darkdetect)(3-clause BSD 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/5yutan5/PyQtDarkTheme",
"name": "pyqtdarktheme",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<3.12",
"maintainer_email": "",
"keywords": "qt,stylesheets,dark-theme",
"author": "Yunosuke Ohsugi",
"author_email": "63651161+5yutan5@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/5c/f1/786feaad7a333072b34a913dbe38aef94b5ae43ad188934f5d70007aea79/pyqtdarktheme-2.1.0.tar.gz",
"platform": null,
"description": "# PyQtDarkTheme\n\nPyQtDarkTheme applies a flat dark theme to QtWidgets application. There's a light theme too. Color balanced from the 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\n**Tests**\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[![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- Sync with OS's theme and accent (Mac, Windows, Linux)\n- Resolve the style differences between Qt versions\n- Provide dark/light theme QPalette\n- Override Qt old standard icons\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.15+\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)\n# Apply the complete dark theme to your Qt App.\nqdarktheme.setup_theme()\n\nmain_win = QMainWindow()\npush_button = QPushButton(\"PyQtDarkTheme!!\")\nmain_win.setCentralWidget(push_button)\n\nmain_win.show()\n\napp.exec()\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### Enable HiDPI\n\n```Python\n# enable_hi_dpi() must be called before the instantiation of QApplication.\nqdarktheme.enable_hi_dpi()\napp = QApplication(sys.argv)\nqdarktheme.setup_theme()\n```\n\nFor Qt6 bindings, HiDPI \u201cjust works\u201d without using this function.\n\n### Light theme\n\n```Python\nqdarktheme.setup_theme(\"light\")\n```\n\n### Sync with OS's theme and accent\n\n```Python\nqdarktheme.setup_theme(\"auto\")\n```\n\n![sync with os theme](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/sync_with_os_theme.gif)\n\nOn macOS, qdarktheme also syncs with accent colors.\n![sync with os accent](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/sync_with_os_accent.gif)\n\n### Customizing colors\n\nYou can customize the theme color.\n\n```python\n# Customize accent color.\nqdarktheme.setup_theme(custom_colors={\"primary\": \"#D0BCFF\"})\n```\n\nFor a list of all customizable colors, see the Theme Color Reference:\n\n- [Theme Color](https://pyqtdarktheme.readthedocs.io/en/latest/reference/theme_color.html)\n\n### Sharp frame\n\nYou can change the corner style.\n\n```python\n# Default is \"rounded\".\nstylesheet = qdarktheme.setup_theme(corner_shape=\"sharp\")\n```\n\n### QPalette and stylesheet\n\nYou can also only load QPalette and stylesheet. `qdarktheme.setup_theme` uses the following functions internally.\n\n```Python\npalette = qdarktheme.load_palette(theme=\"dark\")\nstylesheet = qdarktheme.load_stylesheet(theme=\"dark\")\n```\n\n## Example\n\nTo check all Qt widgets, 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. The accent detector(qdarktheme/_os_appearance/_accent/_mac_detect) is inspired by [darkdetect](https://github.com/albertosottile/darkdetect)(3-clause BSD 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",
"bugtrack_url": null,
"license": "MIT",
"summary": "Flat dark theme for PySide and PyQt.",
"version": "2.1.0",
"split_keywords": [
"qt",
"stylesheets",
"dark-theme"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "6e60c320df2a4cb227739cdb63cfa45d",
"sha256": "8739d99502230fbaca42551ea033c9ae31c81c4ebfec2f1ffde38f32a18bea7a"
},
"downloads": -1,
"filename": "pyqtdarktheme-2.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6e60c320df2a4cb227739cdb63cfa45d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<3.12",
"size": 54242,
"upload_time": "2022-12-25T08:33:10",
"upload_time_iso_8601": "2022-12-25T08:33:10.125612Z",
"url": "https://files.pythonhosted.org/packages/12/cd/8ce0ac84e9f68dc549edcc5cbdeac7511439c5f7ee6c05f1f8826ef05d44/pyqtdarktheme-2.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "6efc5786ea0e3cd42c97548bb6911835",
"sha256": "5f8274ddfa3a5481ed9743cdb0f9debfeb7ff695b3a0d202a8104361d17dadb8"
},
"downloads": -1,
"filename": "pyqtdarktheme-2.1.0.tar.gz",
"has_sig": false,
"md5_digest": "6efc5786ea0e3cd42c97548bb6911835",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<3.12",
"size": 42186,
"upload_time": "2022-12-25T08:33:11",
"upload_time_iso_8601": "2022-12-25T08:33:11.662876Z",
"url": "https://files.pythonhosted.org/packages/5c/f1/786feaad7a333072b34a913dbe38aef94b5ae43ad188934f5d70007aea79/pyqtdarktheme-2.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-25 08:33:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "5yutan5",
"github_project": "PyQtDarkTheme",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyqtdarktheme"
}