1QDarkStyleSheet 2=============== 3 4|Build Status| |Docs Status| |Latest PyPI version| |License: MIT| 5|License: CC BY 4.0| |Conduct| 6 7The most complete dark/light style sheet for Qt applications (Qt4*, Qt5, 8PySide*, PySide2, PyQt4*, PyQt5, QtPy, PyQtGraph, Qt.Py) for Python 92*/3 and C++. 10 11`Check out the complete documentation. <https://qdarkstylesheet.readthedocs.io/en/latest/screenshots.html>`__ 12 13 14What is new? 15------------ 16 17 18Version 3 19~~~~~~~~~ 20 21In the current version 3, `qdarkstyle` is now working as a theme framework, 22currently for dark/light themes, keeping styled widgets identical throughout 23theme colors. 24 25The palette has been redefined and improved (UI/UX) to accept more colors 26and to be able to implement new themes thanks to the 27`Spyder team <https://github.com/spyder-ide/spyder>`__ collaboration. 28 29The current stable version is using Python 3 (preferable 3.6+) and Qt5 30(PyQt5 and PySide 2). 31 32We still preparing the portability to Qt6 since we need changes in 33`QtPy <https://github.com/spyder-ide/qtpy>`__ dependency project. 34 35[*] Python 2, as well as Qt4 (PyQt4 and PySide), will not be supported anymore. 36They still there as it is, but no back-compatibility, fixes, nor features 37will be implemented. 38 39Version 2 40~~~~~~~~~ 41 42We moved to QtPy to simplify your code in v2.8, thus this is a required 43dependency now. We included special patches in three main categories: 44operating system, Qt/binding version, application. 45 46Included in that, lots of widgets' styles were included/fixed. A Qt 47application example (Python only) with almost all types of widgets and 48combinations were included to serve as a portfolio and a checklist for 49new styles. 50 51We have added SCSS in v2.7, so the palette can be accessed programmatically. 52Also, many scripts were added to give freedom to developers who want to 53change the colors of our palette. All images and icons were revised, also 54creating SVG files for all of them. 55 56In version 2.6 and later, a restructure stylesheet is provided. The 57palette has only 9 colors. Most widgets are revised and their styles 58were improved. We also provide a command line (script) to get info that 59could be used when opening issues. See the image below. 60 61 62Version 1 63~~~~~~~~~ 64 65First stable release of QDarkStyle. 66 67 68Installation 69------------ 70 71 72Python 73~~~~~~ 74 75From PyPI: Get the latest stable version of ``qdarkstyle`` package using 76*pip* (preferable): 77 78 .. code:: bash 79 80 pip install qdarkstyle 81 82 83From code: Download/clone the project, go to ``qdarkstyle`` folder then: 84 85- You can use the *setup* script and pip install. 86 87 .. code:: bash 88 89 pip install . 90 91 92- Or, you can use the *setup* script with Python: 93 94 .. code:: bash 95 96 python setup.py install 97 98 99C++ 100~~~ 101 102- Download/clone the project and copy the following files to your 103 application directory (keep the existing directory hierarchy). 104 Substitute the **theme** by the currently available (dark/light) 105 the theme you need to use. 106 107 - **qdarkstyle/theme/style.qss** 108 - **qdarkstyle/theme/style.qrc** 109 - **qdarkstyle/theme/rc/** (the whole directory) 110 111 112- Add **qdarkstyle/theme/style.qrc** to your **.pro file** as follows: 113 114 .. code:: c++ 115 116 RESOURCES += qdarkstyle/theme/style.qrc 117 118 119- Load the stylesheet: 120 121 .. code:: c++ 122 123 QFile f(":qdarkstyle/theme/style.qss"); 124 125 if (!f.exists()) { 126 printf("Unable to set stylesheet, file not found\n"); 127 } 128 else { 129 f.open(QFile::ReadOnly | QFile::Text); 130 QTextStream ts(&f); 131 qApp->setStyleSheet(ts.readAll()); 132 } 133 134 135Note: The ":" in the file name is necessary to define that file as a 136resource library. For more information see the discussion 137`here <https://github.com/ColinDuquesnoy/QDarkStyleSheet/pull/87>`__. 138 139 140Usage in applications 141--------------------- 142 143 144If your project already uses QtPy or you need to set it programmatically, 145it is far more simple 146 147.. code:: python 148 149 import sys 150 import qdarkstyle 151 import os 152 153 # set the environment variable to use a specific wrapper 154 # it can be set to pyqt, pyqt5, pyside or pyside2 (not implemented yet) 155 # you do not need to use QtPy to set this variable 156 os.environ['QT_API'] = 'pyqt5' 157 158 # import from QtPy instead of doing it directly 159 # note that QtPy always uses PyQt5 API 160 from qtpy import QtWidgets 161 162 # create the application and the main window 163 app = QtWidgets.QApplication(sys.argv) 164 window = QtWidgets.QMainWindow() 165 166 # setup stylesheet 167 # the default system in qdarkstyle uses qtpy environment variable 168 app.setStyleSheet(qdarkstyle.load_stylesheet()) 169 170 # run 171 window.show() 172 app.exec_() 173 174 175If you are using PyQt5 directly, see the complete example 176 177.. code:: python 178 179 import sys 180 import qdarkstyle 181 from PyQt5 import QtWidgets 182 183 # create the application and the main window 184 app = QtWidgets.QApplication(sys.argv) 185 window = QtWidgets.QMainWindow() 186 187 # setup stylesheet 188 app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) 189 # or in new API 190 app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api='pyqt5')) 191 192 # run 193 window.show() 194 app.exec_() 195 196 197Here is an example using PySide2 198 199.. code:: python 200 201 import sys 202 import qdarkstyle 203 from PySide2 import QtWidgets 204 205 # create the application and the main window 206 app = QtWidgets.QApplication(sys.argv) 207 window = QtWidgets.QMainWindow() 208 209 # setup stylesheet 210 app.setStyleSheet(qdarkstyle.load_stylesheet_pyside2()) 211 # or in new API 212 app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api='pyside2')) 213 214 # run 215 window.show() 216 app.exec_() 217 218 219If you use PyQtGraph, then the code is 220 221.. code:: python 222 223 import sys 224 import qdarkstyle 225 import os 226 227 # set the environment variable to use a specific wrapper 228 # it can be set to PyQt, PyQt5, PySide or PySide2 (not implemented yet) 229 os.environ['PYQTGRAPH_QT_LIB'] = 'PyQt5' 230 231 # import from pyqtgraph instead of doing it directly 232 # note that PyQtGraph always uses PyQt4 API 233 from pyqtgraph.Qt import QtGui 234 235 # create the application and the main window 236 app = QtGui.QApplication(sys.argv) 237 window = QtGui.QMainWindow() 238 239 # setup stylesheet 240 app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api=os.environ['PYQTGRAPH_QT_LIB']) 241 242 # run 243 window.show() 244 app.exec_() 245 246If you are using Qt.py, which is different from qtpy, you should install 247qtpy then set both to the same binding. 248 249 250Usage of example/portfolio 251-------------------------- 252 253 254There is an example included in the package. You only need to have PySide2 or 255PyQt5 installed on your system. 256 257.. code:: bash 258 259 # dark theme example 260 $ qdarkstyle.example --palette=dark 261 262 # light theme example 263 $ qdarkstyle.example --palette=light 264 265 # no theme/style sheet applied 266 $ qdarkstyle.example --palette=none 267 268 # check all options included 269 $ qdarkstyle.example --help 270 271 272Changelog 273--------- 274 275Please, see `CHANGES <CHANGES.rst>`__ file. 276 277 278License 279------- 280 281This project is licensed under the MIT license. Images contained in this 282project is licensed under CC-BY license. 283 284For more information see `LICENSE <LICENSE.rst>`__ file. 285 286 287Authors 288------- 289 290For more information see `AUTHORS <AUTHORS.rst>`__ file. 291 292 293Contributing 294------------ 295 296Most widgets have been styled. If you find a widget that has not been 297style, just open an issue on the issue tracker or, better, submit a pull 298request. 299 300If you want to contribute, see `CONTRIBUTING <CONTRIBUTING.rst>`__ file. 301 302.. |Build Status| image:: https://travis-ci.org/ColinDuquesnoy/QDarkStyleSheet.png?branch=master 303 :target: https://travis-ci.org/ColinDuquesnoy/QDarkStyleSheet 304.. |Docs Status| image:: https://readthedocs.org/projects/qdarkstylesheet/badge/?version=latest&style=flat 305 :target: https://qdarkstylesheet.readthedocs.io 306.. |Latest PyPI version| image:: https://img.shields.io/pypi/v/QDarkStyle.svg 307 :target: https://pypi.python.org/pypi/QDarkStyle 308.. |License: MIT| image:: https://img.shields.io/dub/l/vibe-d.svg?color=lightgrey 309 :target: https://opensource.org/licenses/MIT 310.. |License: CC BY 4.0| image:: https://img.shields.io/badge/License-CC%20BY%204.0-lightgrey.svg 311 :target: https://creativecommons.org/licenses/by/4.0/ 312.. |Conduct| image:: https://img.shields.io/badge/code%20of%20conduct-contributor%20covenant-green.svg?style=flat&color=lightgrey 313 :target: http://contributor-covenant.org/version/1/4/ 314