├── .github └── workflows │ ├── release.yml │ └── release_test.yml ├── .gitignore ├── LICENSE ├── README.md ├── example.py ├── pyproject.toml ├── setup.cfg ├── setup.py └── vcolorpicker ├── __init__.py ├── __main__.py ├── img.py ├── ui ├── exit.ico ├── img.qrc ├── ui_dark.ui ├── ui_dark_alpha.ui ├── ui_light.ui └── ui_light_alpha.ui ├── ui_dark.py ├── ui_dark_alpha.py ├── ui_light.py ├── ui_light_alpha.py └── vcolorpicker.py /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Publish GitHub Release to PyPI 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | 7 | jobs: 8 | build_and_deploy: 9 | runs-on: ubuntu-latest 10 | if: contains(github.event.head_commit.message, '[publish]') 11 | 12 | steps: 13 | - name: Checkout repository 14 | uses: actions/checkout@v2 15 | 16 | - name: Set up Python 17 | uses: actions/setup-python@v4 18 | with: 19 | python-version: 3.x 20 | 21 | - name: Install pypa/build 22 | run: >- 23 | python3 -m 24 | pip install 25 | build 26 | --user 27 | 28 | - name: Build a binary wheel and a source tarball 29 | run: >- 30 | python3 -m 31 | build 32 | --sdist 33 | --wheel 34 | --outdir dist/ 35 | . 36 | 37 | - name: Publish package to PyPI 38 | uses: pypa/gh-action-pypi-publish@v1.8.8 39 | with: 40 | user: __token__ 41 | password: ${{ secrets.PYPI_API_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/release_test.yml: -------------------------------------------------------------------------------- 1 | name: Publish GitHub Release to TestPyPI 2 | 3 | on: 4 | push: 5 | branches-ignore: [master] 6 | 7 | jobs: 8 | build_and_deploy: 9 | runs-on: ubuntu-latest 10 | if: contains(github.event.head_commit.message, '[publish]') 11 | 12 | steps: 13 | - name: Checkout repository 14 | uses: actions/checkout@v2 15 | 16 | - name: Set up Python 17 | uses: actions/setup-python@v4 18 | with: 19 | python-version: 3.x 20 | 21 | - name: Install pypa/build 22 | run: >- 23 | python3 -m 24 | pip install 25 | build 26 | --user 27 | 28 | - name: Build a binary wheel and a source tarball 29 | run: >- 30 | python3 -m 31 | build 32 | --sdist 33 | --wheel 34 | --outdir dist/ 35 | . 36 | 37 | - name: Publish package to TestPyPI 38 | uses: pypa/gh-action-pypi-publish@v1.8.8 39 | with: 40 | password: ${{ secrets.TEST_PYPI_API_TOKEN }} 41 | repository-url: https://test.pypi.org/legacy/ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### Python template 2 | # Byte-compiled / optimized / DLL files 3 | __pycache__/ 4 | *.py[cod] 5 | *$py.class 6 | 7 | # C extensions 8 | *.so 9 | 10 | # Distribution / packaging 11 | .Python 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | cover/ 54 | 55 | # Translations 56 | *.mo 57 | *.pot 58 | 59 | # Django stuff: 60 | *.log 61 | local_settings.py 62 | db.sqlite3 63 | db.sqlite3-journal 64 | 65 | # Flask stuff: 66 | instance/ 67 | .webassets-cache 68 | 69 | # Scrapy stuff: 70 | .scrapy 71 | 72 | # Sphinx documentation 73 | docs/_build/ 74 | 75 | # PyBuilder 76 | .pybuilder/ 77 | target/ 78 | 79 | # Jupyter Notebook 80 | .ipynb_checkpoints 81 | 82 | # IPython 83 | profile_default/ 84 | ipython_config.py 85 | 86 | # pyenv 87 | # For a library or package, you might want to ignore these files since the code is 88 | # intended to run in multiple environments; otherwise, check them in: 89 | # .python-version 90 | 91 | # pipenv 92 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 93 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 94 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 95 | # install all needed dependencies. 96 | #Pipfile.lock 97 | 98 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 99 | __pypackages__/ 100 | 101 | # Celery stuff 102 | celerybeat-schedule 103 | celerybeat.pid 104 | 105 | # SageMath parsed files 106 | *.sage.py 107 | 108 | # Environments 109 | .env 110 | .venv 111 | env/ 112 | venv/ 113 | ENV/ 114 | env.bak/ 115 | venv.bak/ 116 | 117 | # Spyder project settings 118 | .spyderproject 119 | .spyproject 120 | 121 | # Rope project settings 122 | .ropeproject 123 | 124 | # mkdocs documentation 125 | /site 126 | 127 | # mypy 128 | .mypy_cache/ 129 | .dmypy.json 130 | dmypy.json 131 | 132 | # Pyre type checker 133 | .pyre/ 134 | 135 | # pytype static type analyzer 136 | .pytype/ 137 | 138 | # Cython debug symbols 139 | cython_debug/ 140 | 141 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Tom F 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vcolorpicker 2 | Simple visual Color Picker with a modern UI created with Qt to easily get color input from the user. 3 | 4 | ![colorpicker](https://user-images.githubusercontent.com/71983360/95017068-408f8100-0657-11eb-8001-a6788e94abba.png) 5 | 6 | 7 | ## Installation 8 | 9 | 1. Install using pip: 10 | 11 | ``` 12 | pip install vcolorpicker 13 | ``` 14 | 15 | or clone the repository yourself and run: 16 | 17 | ``` 18 | pip install . 19 | ``` 20 | 21 | ## Usage 22 | 23 | 2. To ask for a color, import the `getColor` function and run it: 24 | 25 | ```python 26 | from vcolorpicker import getColor 27 | 28 | color = getColor() 29 | ``` 30 | 31 | ## Customization 32 | 33 | * **Showing custom last color:** 34 | 35 | ```python 36 | old_color = (255,255,255) 37 | picked_color = getColor(old_color) 38 | ``` 39 | 40 | * **Changing the UI Theme** 41 | 42 | ```python 43 | from vcolorpicker import useLightTheme 44 | 45 | useLightTheme(True) 46 | ``` 47 | 48 | * **Adding Alpha selection** 49 | 50 | ```python 51 | from vcolorpicker import useAlpha 52 | 53 | useAlpha(True) 54 | ``` 55 | 56 | When the ColorPicker uses Alpha, you have to pass a RGBA tuple\ 57 | as the last color, otherwise there wil be an error. 58 | 59 | ```python 60 | old_color = (255,255,255,100) 61 | picked_color = getColor(old_color) # => (r,g,b,a) 62 | ``` 63 | 64 | ## Color Formats and Conversion 65 | 66 | * The default format `getColor` will give you is RGB(A),\ 67 | but you can use vcolorpickers color conversion functions\ 68 | if you have a different format like HSV or HEX. 69 | 70 | `hsv2rgb` **HSV(A)** to **RGB(A)**\ 71 | `rgb2hsv` **RGB(A)** to **HSV(A)**\ 72 | `rgb2hex` **RGB(A)** to **HEX**\ 73 | `hex2rgb` **HEX** to **RGB**\ 74 | `hex2hsv` **HEX** to **HSV**\ 75 | `hsv2hex` **HSV(A)** to **HEX** 76 | 77 | * Example: 78 | ```python 79 | from vcolorpicker import getColor, hsv2rgb, rgb2hsv 80 | 81 | old_color = hsv2rgb((50,50,100,100)) # => (127,255,255,100) 82 | 83 | picked_color = rgb2hsv(getColor(old_color)) 84 | ``` 85 | 86 | * **Color Formats:** 87 | 88 | **RGB** values range from **0** to **255**\ 89 | **HSV** values range from **0** to **100**\ 90 | **HEX** values should be in format: `"XXXXXX"` or `"xxxxxx"`\ 91 | **Alpha** values range from **0** to **100** 92 | 93 | 94 | ## Compatibility 95 | This package is compatible with **Python 3.7+** and above. 96 | It uses [qtpy](https://github.com/spyder-ide/qtpy) under the hood, so it should work with all Qt bindings (PyQt5, PySide2, PySide6, PyQt6). 97 | 98 | ## Previous versions 99 | In previous versions you had to create a ColorPicker object first and then\ 100 | call it's `getColor` method. This is still supported, you just have to\ 101 | import the `ColorPicker` class. 102 | 103 | The color conversion functions are not methods anymore, you can import them\ 104 | directly with `from vcolorpicker import hsv2rgb, rgb2hsv`. 105 | 106 | You also had to create a `QApplication` object before being able to run the\ 107 | ColorPicker, now it automatically creates one by itself if there isn't one yet.\ 108 | If you need to get the auto-created application, you can use this: 109 | 110 | ```python 111 | from PyQt5.QtWidgets import QApplication 112 | app = QApplication.instance() 113 | ``` 114 | 115 | ## Bugs and Improvement ideas 116 | If you find a bug, you can open an issue or write me an email (nlfmt@gmx.de)\ 117 | and I will try to get to it as fast as possible, or you can implement it\ 118 | yourself and create a pull request. 119 | 120 | 121 | ## License 122 | This software is licensed under the **MIT License**.\ 123 | More information is provided in the dedicated LICENSE file. 124 | -------------------------------------------------------------------------------- /example.py: -------------------------------------------------------------------------------- 1 | from vcolorpicker import getColor, useLightTheme, useAlpha 2 | 3 | old_color = (255, 255, 255) 4 | picked_color = getColor(old_color) 5 | print(picked_color) 6 | 7 | useLightTheme(True) 8 | useAlpha(True) 9 | 10 | old_color = (255, 230, 255, 50) 11 | picked_color = getColor(old_color) 12 | print(picked_color) 13 | 14 | 15 | # Using the old way of creating a ColorPicker: 16 | from vcolorpicker import ColorPicker, hsv2rgb, rgb2hsv 17 | 18 | 19 | my_color_picker = ColorPicker(useAlpha=True) 20 | my_color_picker_light = ColorPicker(lightTheme=True) 21 | 22 | 23 | old_color = (255, 255, 255, 50) 24 | picked_color = my_color_picker.getColor(old_color) 25 | print(picked_color) 26 | 27 | 28 | old_color = (255,0,255) 29 | picked_color = my_color_picker_light.getColor(old_color) 30 | print(picked_color) 31 | 32 | 33 | # Don't have your color in RGB format? 34 | my_color = (50, 50, 100, 60) # HSV Color in percent 35 | old_color = hsv2rgb(my_color) 36 | picked_color = rgb2hsv(my_color_picker.getColor(old_color)) 37 | print(picked_color) 38 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools>=61.0"] 3 | build-backend = "setuptools.build_meta" -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = vcolorpicker 3 | version = attr: vcolorpicker.__version__ 4 | description = Open a visual vcolorpicker from any project. 5 | long_description = file: README.md 6 | long_description_content_type = text/markdown 7 | url = https://github.com/nlfmt/pyqt-colorpicker 8 | author = nlfmt 9 | author_email = nlfmt@gmx.de 10 | license = MIT 11 | license_file = LICENSE 12 | classifiers = 13 | Development Status :: 5 - Production/Stable 14 | Environment :: MacOS X 15 | Environment :: Win32 (MS Windows) 16 | Environment :: X11 Applications :: Qt 17 | Intended Audience :: Developers 18 | License :: OSI Approved :: MIT License 19 | Operating System :: OS Independent 20 | Programming Language :: Python :: 3 21 | Programming Language :: Python :: 3 :: Only 22 | Topic :: Software Development :: Libraries 23 | Topic :: Software Development :: User Interfaces 24 | Topic :: Software Development :: Widget Sets 25 | keywords = python color gui colorpicker visual qt 26 | project_urls = 27 | GitHub = https://github.com/nlfmt/pyqt-colorpicker 28 | Bug Tracker = https://github.com/nlfmt/pyqt-colorpicker/issues 29 | 30 | [options] 31 | packages = find: 32 | install_requires = 33 | qtpy 34 | python_requires = >=3.7 35 | include_package_data = True 36 | zip_safe = False 37 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | """Support legacy build tools by providing a setup.py.""" 4 | 5 | import setuptools 6 | 7 | if __name__ == "__main__": 8 | setuptools.setup() -------------------------------------------------------------------------------- /vcolorpicker/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | vcolorpicker 3 | 4 | Simply let a user pick a color using a visual selector. 5 | """ 6 | 7 | __version__ = "1.4.4" 8 | __author__ = 'nlfmt' 9 | 10 | from .vcolorpicker import ColorPicker 11 | from .vcolorpicker import hsv2rgb, hsv2hex, rgb2hsv, rgb2hex, hex2rgb, hex2hsv 12 | from .vcolorpicker import getColor, useAlpha, useLightTheme 13 | 14 | -------------------------------------------------------------------------------- /vcolorpicker/__main__.py: -------------------------------------------------------------------------------- 1 | from vcolorpicker import getColor 2 | 3 | def main(): 4 | print(getColor()) 5 | 6 | 7 | if __name__ == '__main__': 8 | main() -------------------------------------------------------------------------------- /vcolorpicker/img.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Resource object code 4 | # 5 | # Created by: The Resource Compiler for PyQt5 (Qt v5.15.0) 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | from qtpy import QtCore 10 | 11 | qt_resource_data = b"\ 12 | \x00\x00\x06\x8b\ 13 | \x00\ 14 | \x01\x08\x3e\x78\x9c\xed\x9d\x4f\x8b\x5c\x45\x14\xc5\xab\xd3\xe2\ 15 | \x84\x68\x18\x57\xee\x62\x3f\x10\x4c\x60\x3e\x44\x2f\x34\xe8\xca\ 16 | \xa0\x4b\x43\x10\x5c\x04\xc1\x31\x20\x68\xa2\xab\x69\xdd\xeb\x17\ 17 | \x10\x14\x43\xc8\x1f\x5d\xb8\x90\x8c\x22\xa8\x0d\x7e\x84\x28\x6a\ 18 | \x70\x31\xe0\x2e\x62\x1c\x51\x71\x84\xc9\x8c\xb7\x5e\x55\xbd\x57\ 19 | \x5d\xce\xa4\xff\x55\xd5\xad\x7a\x75\x7e\xe1\xa6\xbb\x7a\xfa\xbd\ 20 | \x3a\xb7\xce\x79\x45\x77\xcf\x24\x23\x44\x8f\xfe\x8c\x46\x82\xfe\ 21 | \xae\xc4\xa9\xa3\x3d\xf1\xa8\x10\xe2\x14\x15\x3d\x24\x1f\xac\x1f\ 22 | \xaf\xa1\xaf\xfd\x70\x5c\xd4\x05\x00\x00\x00\x00\x00\x00\x00\x00\ 23 | \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xac\x54\x55\ 24 | \x75\x9c\xea\x65\xaa\xcf\xa8\x7e\xa1\xfa\x97\xea\x6f\xaa\x9f\xa9\ 25 | \x3e\xa4\x7a\x8e\xea\x08\xb7\xce\x98\x50\xbf\x27\xa9\xde\xa0\xba\ 26 | \x4c\xf5\x25\xd5\xa6\x5e\x8b\x57\xa9\x1e\xe3\xd6\xe7\x03\xea\xa3\ 27 | \x47\x75\x81\xea\x57\xaa\xfd\x29\xf5\x1d\xd5\x33\xdc\x9a\x43\x43\ 28 | \x3d\xae\x51\x7d\x31\x65\x2d\xee\x51\xdd\xa0\x1a\x70\xeb\x5d\x14\ 29 | \xd2\xfe\x30\xd5\x27\x33\xf8\x6e\xd7\x1e\xd5\xdb\xdc\xda\x43\x41\ 30 | \xbd\x9d\xa5\xfa\x67\x8e\xf5\xf8\x83\xea\x0c\xb7\xee\x79\xd1\xde\ 31 | \x7f\x3b\xa7\xf7\x76\xbd\xc7\xdd\x83\x6f\xa8\xa7\x37\x17\x5c\x8b\ 32 | \x5d\xaa\x73\xdc\xfa\x67\xc5\x83\xf7\x9d\xcb\xc0\x12\xde\x67\x95\ 33 | \x01\xd2\x78\xcc\x93\xf7\x9d\xc9\x80\x07\xef\xb3\xc8\x00\x69\x3b\ 34 | \x42\x75\xd3\xa3\xf7\xd9\x67\xc0\xa3\xf7\x76\x06\x4e\x73\xf7\x75\ 35 | \x10\xa4\xeb\xb5\x00\xde\x67\x9b\x81\x00\xde\x9b\xfa\xbd\x4a\xec\ 36 | \x7d\x01\xe9\x79\xa4\x52\xaf\x55\x43\xf9\x9f\x55\x06\x02\x7a\x6f\ 37 | \xea\x3a\x77\x8f\x36\xa4\x67\x3d\x70\xbf\xd9\x64\x20\x82\xf7\xb2\ 38 | \xe4\xe7\x03\x27\xb8\x7b\x35\x54\xd3\x3f\xcf\x28\x22\x03\x91\xbc\ 39 | \x37\xb5\xce\xdd\xaf\x81\xb4\xdc\x89\xd8\x77\x92\x19\x88\xec\xbd\ 40 | \xac\x2b\xdc\x3d\x1b\x22\xf7\x9d\x5c\x06\x18\xbc\x97\xf5\x35\x77\ 41 | \xdf\x86\x4a\x7d\x2f\xa7\xc8\x0c\x30\x79\x2f\x6b\xcc\xdd\xbb\x81\ 42 | \xb4\xdc\x66\x5a\x03\xd6\x0c\x30\x7a\x2f\xeb\x2a\x57\xdf\x2e\xa4\ 43 | \xe5\x3a\xe3\x3a\xb0\x64\x80\xd9\x7b\x59\x17\x62\xf7\x7c\x18\xa4\ 44 | \xe5\x79\xe6\xb5\x88\x9a\x81\x04\xbc\x97\xdf\x27\x7d\x3c\x56\xbf\ 45 | \xd3\xa8\xd4\x67\xbf\xb7\x4a\xc8\x40\x02\xde\xcb\xda\x0c\xdd\xe7\ 46 | \xbc\x90\xa6\xa7\x2a\xf5\xf9\x34\xf7\xda\x04\xcb\x40\x22\xde\xcb\ 47 | \xd7\xda\x6b\xa1\x7a\x5c\x06\xd2\x75\x31\x81\xf5\x09\x92\x81\x44\ 48 | \xbc\x97\xfb\xfe\x0b\xbe\x7b\xf3\x09\xe9\x7b\x37\x81\x75\xf2\x9a\ 49 | \x81\x44\xbc\x97\x75\xc9\x57\x4f\x21\xe9\x52\x06\xe0\xfd\x62\x74\ 50 | \x21\x03\xf0\x7e\x39\x72\xce\x00\xbc\xf7\x43\x8e\x19\x80\xf7\x7e\ 51 | \xc9\x29\x03\xf0\x3e\x0c\x39\x64\x00\xde\x87\x25\xe5\x0c\xc0\xfb\ 52 | \x38\xa4\x98\x01\x78\x1f\x97\x94\x32\x00\xef\x79\x48\x28\x03\x29\ 53 | \x54\x51\xde\x1b\x90\x81\x72\xbd\x37\x14\x9e\x81\xa2\xbd\x37\x14\ 54 | \x9a\x01\x78\x6f\x51\x58\x06\xe0\xfd\x01\x14\x92\x01\x78\x7f\x1f\ 55 | \x3a\x9e\x01\x78\x3f\x03\x1d\xcd\x00\xbc\x9f\x83\x8e\x65\x00\xde\ 56 | \x2f\x40\x47\x32\x00\xef\x97\x20\xf3\x0c\xc0\x7b\x0f\x64\x9a\x01\ 57 | \x78\xef\x91\xcc\x32\x00\xef\x03\x90\x49\x06\xe0\x7d\x40\x12\xcf\ 58 | \x00\xbc\x8f\x40\xa2\x19\x80\xf7\x11\x49\x2c\x03\xf0\x3e\x32\x55\ 59 | \x3a\x3f\xb7\x23\x8b\xfd\xff\x21\x29\x89\xc4\xbc\x47\x06\x22\x92\ 60 | \xa8\xf7\xc8\x40\x04\x12\xf7\x1e\x19\x08\x48\x26\xde\x23\x03\x01\ 61 | \xc8\xcc\x7b\x64\xc0\x23\x99\x7a\x8f\x0c\x78\x20\x73\xef\x91\x81\ 62 | \x25\xe8\x88\xf7\xc8\xc0\x02\x74\xcc\x7b\x64\x60\x0e\x3a\xea\x3d\ 63 | \x32\x30\x03\x1d\xf7\x1e\x19\xb8\x0f\x85\x78\x8f\x0c\x1c\x00\xad\ 64 | \xc7\x5b\x09\x78\x82\x0c\x30\x50\xa8\xf7\xc8\x80\x28\xde\xfb\xa2\ 65 | \x33\x00\xef\xcb\xcd\x40\x42\xde\x5f\xaa\xd2\xf9\x39\xa2\x22\x32\ 66 | \x90\x92\xf7\x96\x26\x64\x20\x02\x29\x7a\x6f\x69\x43\x06\x02\x92\ 67 | \xb2\xf7\x96\x46\x64\x20\x00\x39\x78\x6f\x69\x45\x06\x3c\x92\x93\ 68 | \xf7\x96\x66\x64\xc0\x03\x39\x7a\x6f\x69\x47\x06\x96\x20\x67\xef\ 69 | \xad\x1e\x90\x81\x05\xe8\x82\xf7\x56\x2f\xc8\xc0\x1c\x74\xc9\x7b\ 70 | \xab\x27\x64\x60\x06\x48\xdf\xd9\x04\xd6\xc8\xab\xf7\x56\x6f\xa9\ 71 | \x64\xe0\x1d\xdf\xbd\xf9\x80\x74\xad\x55\x7c\xbf\x07\x3c\xa8\xf7\ 72 | \x56\x8f\x29\x64\x40\xfe\x0e\xc0\xa7\x43\xf5\xb8\x28\xa4\x69\x33\ 73 | \x81\xb5\x09\xfe\xef\x70\x13\xc9\xc0\x8f\x54\x0f\x84\xee\x75\x56\ 74 | \x48\xcb\x49\x9d\xcb\x4e\x7b\x6f\xf5\x9b\x42\x06\x9e\x8d\xd5\xef\ 75 | \x34\x48\xcb\xeb\xa5\x78\x6f\xf5\xcc\x9d\x81\xf7\x63\xf7\x7c\x18\ 76 | \xa4\xe5\x6a\x49\xde\x5b\x7d\x73\x66\xe0\x7b\xae\xbe\x5d\x48\xcb\ 77 | \x37\xa5\x79\x6f\xf5\xce\x95\x81\xbb\xdc\xbd\x1b\x48\xcb\x57\x25\ 78 | \x7a\x6f\x60\xca\xc0\x5f\xdc\x7d\x1b\x48\xcb\x47\xa5\x7a\x6f\x60\ 79 | \xc8\xc0\x6d\xee\x9e\x0d\xa4\xe5\x95\x92\xbd\x37\x44\xce\xc0\xc7\ 80 | \xdc\xfd\x1a\x48\xcb\x09\xaa\x7b\x25\x7b\x6f\x88\x98\x81\x17\xb9\ 81 | \x7b\xb5\xa9\xc2\xbf\x07\x48\xde\x7b\x43\x84\x0c\xdc\xa1\x7a\x88\ 82 | \xbb\x4f\x1b\xbd\x07\xdc\x2d\xdd\x7b\x43\xe0\x0c\x9c\xe7\xee\xef\ 83 | \x20\x48\xd7\x69\xaa\xdd\xd2\xbd\x37\x04\xca\xc0\x35\xaa\x1e\x77\ 84 | \x6f\x87\x41\xda\xce\x79\xcc\x40\xb6\xde\x1b\x3c\x67\xe0\x73\xaa\ 85 | \x07\xb9\x7b\x9a\x86\xa7\x0c\x64\xef\xbd\xc1\x53\x06\xa4\xf7\x47\ 86 | \xb9\x7b\x99\x95\x25\x33\xd0\x19\xef\x0d\x4b\x66\x40\x7a\xbf\xc2\ 87 | \xdd\xc3\xbc\x54\xea\xf5\xc0\x6f\x73\xf4\xb9\x53\x25\xfa\xda\xc6\ 88 | \x07\xd4\xdb\xc5\x05\xae\x89\x1b\x39\x7a\x6f\xa8\xd4\xfb\x82\x6b\ 89 | \x33\xf4\x2d\x33\xbe\xc6\xad\x37\x34\xd4\xe3\x93\x54\x3f\xcd\xe0\ 90 | \xbb\x7c\x8f\x77\xbe\x4a\xf8\xb5\xde\x3c\xe8\x1c\xac\x53\x7d\x40\ 91 | \x75\x53\xfb\x2d\x3f\x37\x96\xdf\x3b\x7e\x82\x5b\x5f\x4c\xa8\xdf\ 92 | \x3e\xd5\x19\xaa\xcb\x54\xb7\xf4\x1e\xf9\x67\xa5\x7e\xae\xe3\x53\ 93 | \xaa\x97\xa8\x8e\x71\xeb\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\ 94 | \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe9\xb3\x0f\x5c\x46\ 95 | \x03\x75\xbb\xdb\xaf\x6f\xf6\xc4\xaa\x1a\x6f\xab\xc5\xda\x15\x2b\ 96 | \x6a\xbc\x25\x36\xe4\xcd\x8e\x50\xcf\xdb\x1f\x8b\xa1\x7a\x5a\x4f\ 97 | \x9f\x47\x0c\xd4\xd3\xf4\x22\x0b\x75\xa2\xb1\x50\xc7\xed\x09\x75\ 98 | \x22\x1a\x0f\xd5\x79\xd5\x89\x46\x42\x1d\xb7\xd3\x8e\x57\xd5\x79\ 99 | \xd5\x89\x47\xfa\xb8\xad\x76\xdc\xd7\xe7\x31\x63\xf7\x56\xa8\xe9\ 100 | \xdb\xf1\x46\x3d\x7d\x3b\x1e\xd6\xd3\xb7\xe3\x41\x3d\x7d\x3b\x5e\ 101 | \xad\xa7\x6f\xe6\x91\x02\xb6\xcc\x58\xdf\xd1\x0f\xab\x27\xf6\x9a\ 102 | \xc3\xd4\x89\x44\x3d\xbd\xea\x4b\x4e\x24\x36\xe4\xf4\xaa\x6f\x75\ 103 | \x4f\x3d\xaa\xd7\x89\x9e\xb9\xd3\x86\xb3\x3e\xd3\xb6\x91\xa3\x67\ 104 | \x6a\xa6\xd7\x02\x9a\xe9\xb5\x80\x66\x7a\x2d\xa0\x99\x5e\x0b\x68\ 105 | \xa6\xd7\x02\xda\xe9\x95\x00\xfb\xda\x18\xa9\x61\xcf\x8c\xc7\x6a\ 106 | \xdc\x37\xe3\x2d\x35\x5e\x31\xe3\x6d\x35\x5e\x35\xe3\x9d\x89\xe9\ 107 | \x1b\x01\x43\x33\xde\x9b\x9c\xde\x08\x68\x86\x4a\x40\xaf\x1d\x8f\ 108 | \x27\xa6\xd7\x02\x56\xda\xf1\xf6\xc4\xf4\x5a\xc0\xa0\x1d\xef\x4e\ 109 | \x4c\xff\xff\xb1\xfb\x7c\xf7\x7c\xee\x7c\xae\x1e\x57\xaf\xd3\x8f\ 110 | \xdb\xaf\xbb\x1e\xee\x7a\xb9\xeb\xe9\xae\xb7\xeb\x87\xeb\x97\xe3\ 111 | \xa7\xeb\xb7\x9b\x07\x37\x2f\x6e\x9e\xe4\xf4\x76\xde\xea\xbb\x5b\ 112 | \xad\x80\xfa\xa9\x56\x5e\xeb\x53\xb5\x79\x76\xf3\xee\x5e\x0f\xee\ 113 | \xf5\xe2\x5e\x4f\x7a\xa6\x46\x80\xbe\xd3\x08\x18\x8b\xe6\x7a\x3d\ 114 | \xf4\x7a\x1e\x3a\xd7\xfb\x86\xb3\x1f\x68\xd9\x87\xed\x27\xee\x7e\ 115 | \xe3\xee\x47\x13\xfb\xd5\xb8\xdd\xcf\xcc\x78\xa8\xfb\x36\xfb\xc7\ 116 | \x86\x5e\x97\xbe\x3e\xce\xac\xdb\x8a\x3a\xae\xd9\x4f\x57\xd5\x71\ 117 | \xcd\x7e\x3b\x50\xc7\x35\xfb\xb1\x32\xb0\xdd\xaf\x95\xc1\x63\xe3\ 118 | \xab\x95\x48\xa0\xf9\x0f\x4d\xfb\xb6\x32\ 119 | " 120 | 121 | qt_resource_name = b"\ 122 | \x00\x03\ 123 | \x00\x00\x70\x37\ 124 | \x00\x69\ 125 | \x00\x6d\x00\x67\ 126 | \x00\x08\ 127 | \x0f\x07\x42\x1f\ 128 | \x00\x65\ 129 | \x00\x78\x00\x69\x00\x74\x00\x2e\x00\x69\x00\x63\x00\x6f\ 130 | " 131 | 132 | qt_resource_struct_v1 = b"\ 133 | \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ 134 | \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ 135 | \x00\x00\x00\x0c\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\ 136 | " 137 | 138 | qt_resource_struct_v2 = b"\ 139 | \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ 140 | \x00\x00\x00\x00\x00\x00\x00\x00\ 141 | \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ 142 | \x00\x00\x00\x00\x00\x00\x00\x00\ 143 | \x00\x00\x00\x0c\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\ 144 | \x00\x00\x01\x75\x65\x7f\xd2\x60\ 145 | " 146 | 147 | qt_version = [int(v) for v in QtCore.qVersion().split('.')] 148 | if qt_version < [5, 8, 0]: 149 | rcc_version = 1 150 | qt_resource_struct = qt_resource_struct_v1 151 | else: 152 | rcc_version = 2 153 | qt_resource_struct = qt_resource_struct_v2 154 | 155 | def qInitResources(): 156 | QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) 157 | 158 | def qCleanupResources(): 159 | QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) 160 | 161 | qInitResources() 162 | -------------------------------------------------------------------------------- /vcolorpicker/ui/exit.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlfmt/pyqt-colorpicker/3049def11127f1e61beae244c633732cb550aae6/vcolorpicker/ui/exit.ico -------------------------------------------------------------------------------- /vcolorpicker/ui/img.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | exit.ico 4 | 5 | 6 | -------------------------------------------------------------------------------- /vcolorpicker/ui/ui_dark.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ColorPicker 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 400 22 | 300 23 | 24 | 25 | 26 | 27 | 400 28 | 300 29 | 30 | 31 | 32 | Form 33 | 34 | 35 | QWidget{ 36 | background-color: none; 37 | } 38 | 39 | /* LINE EDIT */ 40 | QLineEdit{ 41 | color: rgb(221, 221, 221); 42 | background-color: #303030; 43 | border: 2px solid #303030; 44 | border-radius: 5px; 45 | selection-color: rgb(16, 16, 16); 46 | selection-background-color: rgb(221, 51, 34); 47 | font-family: Segoe UI; 48 | font-size: 11pt; 49 | } 50 | QLineEdit::focus{ 51 | border-color: #aaaaaa; 52 | } 53 | 54 | /* PUSH BUTTON */ 55 | QPushButton{ 56 | border: 2px solid #aaa; 57 | border-radius: 5px; 58 | font-family: Segoe UI; 59 | font-size: 9pt; 60 | font-weight: bold; 61 | color: #ccc; 62 | width: 100px; 63 | } 64 | QPushButton:hover{ 65 | border: 2px solid #aaa; 66 | color: #222; 67 | background-color: #aaa; 68 | } 69 | QPushButton:pressed{ 70 | border: 2px solid #aaa; 71 | color: #222; 72 | background-color: #aaa; 73 | } 74 | 75 | 76 | 77 | 0 78 | 79 | 80 | 10 81 | 82 | 83 | 10 84 | 85 | 86 | 10 87 | 88 | 89 | 10 90 | 91 | 92 | 93 | 94 | QFrame{ 95 | background-color: #202020; 96 | border-radius: 10px; 97 | } 98 | 99 | 100 | QFrame::StyledPanel 101 | 102 | 103 | QFrame::Raised 104 | 105 | 106 | 107 | 10 108 | 109 | 110 | 0 111 | 112 | 113 | 0 114 | 115 | 116 | 0 117 | 118 | 119 | 0 120 | 121 | 122 | 123 | 124 | 125 | 0 126 | 32 127 | 128 | 129 | 130 | background-color: rgb(48, 48, 48); 131 | 132 | 133 | QFrame::StyledPanel 134 | 135 | 136 | QFrame::Raised 137 | 138 | 139 | 140 | 5 141 | 142 | 143 | 10 144 | 145 | 146 | 0 147 | 148 | 149 | 10 150 | 151 | 152 | 0 153 | 154 | 155 | 156 | 157 | Qt::Horizontal 158 | 159 | 160 | QSizePolicy::Fixed 161 | 162 | 163 | 164 | 16 165 | 0 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 0 175 | 0 176 | 177 | 178 | 179 | 180 | 16777215 181 | 16777215 182 | 183 | 184 | 185 | QLabel{ 186 | color: #fff; 187 | font-family: Segoe UI; 188 | font-size: 9pt; 189 | } 190 | 191 | 192 | <strong>COLOR</strong> PICKER 193 | 194 | 195 | Qt::AlignCenter 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 16 204 | 16 205 | 206 | 207 | 208 | 209 | 16 210 | 16 211 | 212 | 213 | 214 | Qt::NoFocus 215 | 216 | 217 | QPushButton{ 218 | border: none; 219 | background-color: #aaaaaa; 220 | border-radius: 8px 221 | } 222 | QPushButton:hover{ 223 | background-color: #666666; 224 | } 225 | 226 | 227 | 228 | 229 | 230 | 231 | :/img/exit.ico:/img/exit.ico 232 | 233 | 234 | 235 | 12 236 | 12 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | Qt::LeftToRight 248 | 249 | 250 | QWidget{ 251 | border-radius: 5px 252 | } 253 | #color_view{ 254 | border-bottom-left-radius: 7px; 255 | border-bottom-right-radius: 7px; 256 | } 257 | #black_overlay{ 258 | border-bottom-left-radius: 6px; 259 | border-bottom-right-radius: 6px; 260 | } 261 | 262 | 263 | QFrame::StyledPanel 264 | 265 | 266 | QFrame::Raised 267 | 268 | 269 | 270 | 10 271 | 272 | 273 | 10 274 | 275 | 276 | 0 277 | 278 | 279 | 10 280 | 281 | 282 | 0 283 | 284 | 285 | 286 | 287 | 288 | 200 289 | 200 290 | 291 | 292 | 293 | 294 | 200 295 | 200 296 | 297 | 298 | 299 | /* ALL CHANGES HERE WILL BE OVERWRITTEN */; 300 | background-color: qlineargradient(x1:1, x2:0, stop:0 hsl(0%,100%,50%), stop:1 rgba(255, 255, 255, 255)); 301 | 302 | 303 | 304 | 305 | QFrame::StyledPanel 306 | 307 | 308 | QFrame::Raised 309 | 310 | 311 | 312 | 0 313 | 314 | 315 | 0 316 | 317 | 318 | 0 319 | 320 | 321 | 0 322 | 323 | 324 | 0 325 | 326 | 327 | 328 | 329 | background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 0), stop:1 rgba(0, 0, 0, 255)); 330 | 331 | 332 | 333 | 334 | 335 | QFrame::StyledPanel 336 | 337 | 338 | QFrame::Raised 339 | 340 | 341 | 342 | 343 | 194 344 | 20 345 | 12 346 | 12 347 | 348 | 349 | 350 | 351 | 12 352 | 12 353 | 354 | 355 | 356 | 357 | 12 358 | 12 359 | 360 | 361 | 362 | background-color:none; 363 | border: 1px solid white; 364 | border-radius: 5px; 365 | 366 | 367 | QFrame::StyledPanel 368 | 369 | 370 | QFrame::Raised 371 | 372 | 373 | 374 | 375 | 1 376 | 1 377 | 10 378 | 10 379 | 380 | 381 | 382 | 383 | 10 384 | 10 385 | 386 | 387 | 388 | 389 | 10 390 | 10 391 | 392 | 393 | 394 | 395 | 10 396 | 10 397 | 398 | 399 | 400 | background-color: none; 401 | border: 1px solid black; 402 | border-radius: 5px; 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 40 419 | 0 420 | 421 | 422 | 423 | 424 | 425 | 426 | QFrame::StyledPanel 427 | 428 | 429 | QFrame::Raised 430 | 431 | 432 | 433 | 434 | 10 435 | 0 436 | 20 437 | 200 438 | 439 | 440 | 441 | 442 | 20 443 | 200 444 | 445 | 446 | 447 | background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(255, 0, 0, 255), stop:0.166 rgba(255, 255, 0, 255), stop:0.333 rgba(0, 255, 0, 255), stop:0.5 rgba(0, 255, 255, 255), stop:0.666 rgba(0, 0, 255, 255), stop:0.833 rgba(255, 0, 255, 255), stop:1 rgba(255, 0, 0, 255)); 448 | border-radius: 5px; 449 | 450 | 451 | QFrame::StyledPanel 452 | 453 | 454 | QFrame::Raised 455 | 456 | 457 | 458 | 459 | 460 | 7 461 | 185 462 | 26 463 | 15 464 | 465 | 466 | 467 | 468 | 26 469 | 0 470 | 471 | 472 | 473 | background-color: #aaa; 474 | border-radius: 5px; 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 7 484 | 0 485 | 26 486 | 200 487 | 488 | 489 | 490 | 491 | 20 492 | 200 493 | 494 | 495 | 496 | background-color: none; 497 | 498 | 499 | QFrame::StyledPanel 500 | 501 | 502 | QFrame::Raised 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 110 512 | 200 513 | 514 | 515 | 516 | 517 | 120 518 | 200 519 | 520 | 521 | 522 | QLabel{ 523 | font-family: Segoe UI; 524 | font-weight: bold; 525 | font-size: 11pt; 526 | color: #aaaaaa; 527 | border-radius: 5px; 528 | } 529 | 530 | 531 | 532 | QFrame::StyledPanel 533 | 534 | 535 | QFrame::Raised 536 | 537 | 538 | 539 | 5 540 | 541 | 542 | 5 543 | 544 | 545 | 15 546 | 547 | 548 | 0 549 | 550 | 551 | 15 552 | 553 | 554 | 1 555 | 556 | 557 | 558 | 559 | 560 | 0 561 | 24 562 | 563 | 564 | 565 | /* ALL CHANGES HERE WILL BE OVERWRITTEN */; 566 | background-color: rgb(255, 255, 255); 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 0 579 | 24 580 | 581 | 582 | 583 | /* ALL CHANGES HERE WILL BE OVERWRITTEN */; 584 | background-color: rgb(0, 0, 0); 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | R 595 | 596 | 597 | red 598 | 599 | 600 | 601 | 602 | 603 | 604 | 255 605 | 606 | 607 | Qt::AlignCenter 608 | 609 | 610 | false 611 | 612 | 613 | 614 | 615 | 616 | 617 | G 618 | 619 | 620 | green 621 | 622 | 623 | 624 | 625 | 626 | 627 | 255 628 | 629 | 630 | Qt::AlignCenter 631 | 632 | 633 | 634 | 635 | 636 | 637 | B 638 | 639 | 640 | blue 641 | 642 | 643 | 644 | 645 | 646 | 647 | 255 648 | 649 | 650 | Qt::AlignCenter 651 | 652 | 653 | 654 | 655 | 656 | 657 | font-size: 14pt; 658 | 659 | 660 | # 661 | 662 | 663 | blue 664 | 665 | 666 | 667 | 668 | 669 | 670 | ffffff 671 | 672 | 673 | Qt::AlignCenter 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 0 688 | 0 689 | 690 | 691 | 692 | QFrame{ 693 | background-color: #1d1d1d; 694 | padding: 5px 695 | } 696 | 697 | 698 | 699 | QFrame::StyledPanel 700 | 701 | 702 | QFrame::Raised 703 | 704 | 705 | 706 | 10 707 | 708 | 709 | 100 710 | 711 | 712 | 0 713 | 714 | 715 | 100 716 | 717 | 718 | 0 719 | 720 | 721 | 722 | 723 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 724 | 725 | 726 | true 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | red 741 | green 742 | blue 743 | 744 | 745 | 746 | 747 | 748 | 749 | -------------------------------------------------------------------------------- /vcolorpicker/ui/ui_dark_alpha.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ColorPicker 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 400 22 | 300 23 | 24 | 25 | 26 | 27 | 400 28 | 300 29 | 30 | 31 | 32 | Form 33 | 34 | 35 | QWidget{ 36 | background-color: none; 37 | } 38 | 39 | /* LINE EDIT */ 40 | QLineEdit{ 41 | color: rgb(221, 221, 221); 42 | background-color: #303030; 43 | border: 2px solid #303030; 44 | border-radius: 5px; 45 | selection-color: rgb(16, 16, 16); 46 | selection-background-color: rgb(221, 51, 34); 47 | font-family: Segoe UI; 48 | font-size: 11pt; 49 | } 50 | QLineEdit::focus{ 51 | border-color: #aaaaaa; 52 | } 53 | 54 | /* PUSH BUTTON */ 55 | QPushButton{ 56 | border: 2px solid #aaa; 57 | border-radius: 5px; 58 | font-family: Segoe UI; 59 | font-size: 9pt; 60 | font-weight: bold; 61 | color: #ccc; 62 | width: 100px; 63 | } 64 | QPushButton:hover{ 65 | border: 2px solid #aaa; 66 | color: #222; 67 | background-color: #aaa; 68 | } 69 | QPushButton:pressed{ 70 | border: 2px solid #aaa; 71 | color: #222; 72 | background-color: #aaa; 73 | } 74 | 75 | 76 | 77 | 0 78 | 79 | 80 | 10 81 | 82 | 83 | 10 84 | 85 | 86 | 10 87 | 88 | 89 | 10 90 | 91 | 92 | 93 | 94 | QFrame{ 95 | background-color: #202020; 96 | border-radius: 10px; 97 | } 98 | 99 | 100 | QFrame::StyledPanel 101 | 102 | 103 | QFrame::Raised 104 | 105 | 106 | 107 | 10 108 | 109 | 110 | 0 111 | 112 | 113 | 0 114 | 115 | 116 | 0 117 | 118 | 119 | 0 120 | 121 | 122 | 123 | 124 | 125 | 0 126 | 32 127 | 128 | 129 | 130 | background-color: rgb(48, 48, 48); 131 | 132 | 133 | QFrame::StyledPanel 134 | 135 | 136 | QFrame::Raised 137 | 138 | 139 | 140 | 5 141 | 142 | 143 | 10 144 | 145 | 146 | 0 147 | 148 | 149 | 10 150 | 151 | 152 | 0 153 | 154 | 155 | 156 | 157 | Qt::Horizontal 158 | 159 | 160 | QSizePolicy::Fixed 161 | 162 | 163 | 164 | 16 165 | 0 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 0 175 | 0 176 | 177 | 178 | 179 | 180 | 16777215 181 | 16777215 182 | 183 | 184 | 185 | QLabel{ 186 | color: #fff; 187 | font-family: Segoe UI; 188 | font-size: 9pt; 189 | } 190 | 191 | 192 | <strong>COLOR</strong> PICKER 193 | 194 | 195 | Qt::AlignCenter 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 16 204 | 16 205 | 206 | 207 | 208 | 209 | 16 210 | 16 211 | 212 | 213 | 214 | Qt::NoFocus 215 | 216 | 217 | QPushButton{ 218 | border: none; 219 | background-color: #aaaaaa; 220 | border-radius: 8px 221 | } 222 | QPushButton:hover{ 223 | background-color: #666666; 224 | } 225 | 226 | 227 | 228 | 229 | 230 | 231 | :/img/exit.ico:/img/exit.ico 232 | 233 | 234 | 235 | 12 236 | 12 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | Qt::LeftToRight 248 | 249 | 250 | QWidget{ 251 | border-radius: 5px 252 | } 253 | #color_view{ 254 | border-bottom-left-radius: 7px; 255 | border-bottom-right-radius: 7px; 256 | } 257 | #black_overlay{ 258 | border-bottom-left-radius: 6px; 259 | border-bottom-right-radius: 6px; 260 | } 261 | 262 | 263 | QFrame::StyledPanel 264 | 265 | 266 | QFrame::Raised 267 | 268 | 269 | 270 | 10 271 | 272 | 273 | 10 274 | 275 | 276 | 0 277 | 278 | 279 | 10 280 | 281 | 282 | 0 283 | 284 | 285 | 286 | 287 | 288 | 200 289 | 200 290 | 291 | 292 | 293 | 294 | 200 295 | 200 296 | 297 | 298 | 299 | /* ALL CHANGES HERE WILL BE OVERWRITTEN */; 300 | background-color: qlineargradient(x1:1, x2:0, stop:0 hsl(0%,100%,50%), stop:1 rgba(255, 255, 255, 255)); 301 | 302 | 303 | 304 | 305 | QFrame::StyledPanel 306 | 307 | 308 | QFrame::Raised 309 | 310 | 311 | 312 | 0 313 | 314 | 315 | 0 316 | 317 | 318 | 0 319 | 320 | 321 | 0 322 | 323 | 324 | 0 325 | 326 | 327 | 328 | 329 | background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 0), stop:1 rgba(0, 0, 0, 255)); 330 | 331 | 332 | 333 | 334 | 335 | QFrame::StyledPanel 336 | 337 | 338 | QFrame::Raised 339 | 340 | 341 | 342 | 343 | 194 344 | 20 345 | 12 346 | 12 347 | 348 | 349 | 350 | 351 | 12 352 | 12 353 | 354 | 355 | 356 | 357 | 12 358 | 12 359 | 360 | 361 | 362 | background-color:none; 363 | border: 1px solid white; 364 | border-radius: 5px; 365 | 366 | 367 | QFrame::StyledPanel 368 | 369 | 370 | QFrame::Raised 371 | 372 | 373 | 374 | 375 | 1 376 | 1 377 | 10 378 | 10 379 | 380 | 381 | 382 | 383 | 10 384 | 10 385 | 386 | 387 | 388 | 389 | 10 390 | 10 391 | 392 | 393 | 394 | 395 | 10 396 | 10 397 | 398 | 399 | 400 | background-color: none; 401 | border: 1px solid black; 402 | border-radius: 5px; 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 40 419 | 0 420 | 421 | 422 | 423 | 424 | 425 | 426 | QFrame::StyledPanel 427 | 428 | 429 | QFrame::Raised 430 | 431 | 432 | 433 | 434 | 10 435 | 0 436 | 20 437 | 200 438 | 439 | 440 | 441 | 442 | 20 443 | 200 444 | 445 | 446 | 447 | background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(255, 0, 0, 255), stop:0.166 rgba(255, 255, 0, 255), stop:0.333 rgba(0, 255, 0, 255), stop:0.5 rgba(0, 255, 255, 255), stop:0.666 rgba(0, 0, 255, 255), stop:0.833 rgba(255, 0, 255, 255), stop:1 rgba(255, 0, 0, 255)); 448 | border-radius: 5px; 449 | 450 | 451 | QFrame::StyledPanel 452 | 453 | 454 | QFrame::Raised 455 | 456 | 457 | 458 | 459 | 460 | 7 461 | 185 462 | 26 463 | 15 464 | 465 | 466 | 467 | 468 | 26 469 | 0 470 | 471 | 472 | 473 | background-color: #aaa; 474 | border-radius: 5px; 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 7 484 | 0 485 | 26 486 | 200 487 | 488 | 489 | 490 | 491 | 20 492 | 200 493 | 494 | 495 | 496 | background-color: none; 497 | 498 | 499 | QFrame::StyledPanel 500 | 501 | 502 | QFrame::Raised 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 110 512 | 200 513 | 514 | 515 | 516 | 517 | 120 518 | 200 519 | 520 | 521 | 522 | QLabel{ 523 | font-family: Segoe UI; 524 | font-weight: bold; 525 | font-size: 11pt; 526 | color: #aaaaaa; 527 | border-radius: 5px; 528 | } 529 | 530 | 531 | 532 | QFrame::StyledPanel 533 | 534 | 535 | QFrame::Raised 536 | 537 | 538 | 539 | 5 540 | 541 | 542 | 5 543 | 544 | 545 | 15 546 | 547 | 548 | 0 549 | 550 | 551 | 15 552 | 553 | 554 | 1 555 | 556 | 557 | 558 | 559 | 560 | 0 561 | 24 562 | 563 | 564 | 565 | /* ALL CHANGES HERE WILL BE OVERWRITTEN */; 566 | background-color: rgb(255, 255, 255); 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 0 579 | 24 580 | 581 | 582 | 583 | /* ALL CHANGES HERE WILL BE OVERWRITTEN */; 584 | background-color: rgb(0, 0, 0); 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | R 595 | 596 | 597 | red 598 | 599 | 600 | 601 | 602 | 603 | 604 | 255 605 | 606 | 607 | Qt::AlignCenter 608 | 609 | 610 | false 611 | 612 | 613 | 614 | 615 | 616 | 617 | G 618 | 619 | 620 | green 621 | 622 | 623 | 624 | 625 | 626 | 627 | 255 628 | 629 | 630 | Qt::AlignCenter 631 | 632 | 633 | 634 | 635 | 636 | 637 | B 638 | 639 | 640 | blue 641 | 642 | 643 | 644 | 645 | 646 | 647 | 255 648 | 649 | 650 | Qt::AlignCenter 651 | 652 | 653 | 654 | 655 | 656 | 657 | font-size: 14pt; 658 | 659 | 660 | # 661 | 662 | 663 | blue 664 | 665 | 666 | 667 | 668 | 669 | 670 | ffffff 671 | 672 | 673 | Qt::AlignCenter 674 | 675 | 676 | 677 | 678 | 679 | 680 | A 681 | 682 | 683 | blue 684 | 685 | 686 | 687 | 688 | 689 | 690 | 100 691 | 692 | 693 | Qt::AlignCenter 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 0 708 | 0 709 | 710 | 711 | 712 | QFrame{ 713 | background-color: #1d1d1d; 714 | padding: 5px 715 | } 716 | 717 | 718 | 719 | QFrame::StyledPanel 720 | 721 | 722 | QFrame::Raised 723 | 724 | 725 | 726 | 10 727 | 728 | 729 | 100 730 | 731 | 732 | 0 733 | 734 | 735 | 100 736 | 737 | 738 | 0 739 | 740 | 741 | 742 | 743 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 744 | 745 | 746 | true 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | red 761 | green 762 | blue 763 | 764 | 765 | 766 | 767 | 768 | 769 | -------------------------------------------------------------------------------- /vcolorpicker/ui/ui_light.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ColorPicker 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 400 22 | 300 23 | 24 | 25 | 26 | 27 | 400 28 | 300 29 | 30 | 31 | 32 | Form 33 | 34 | 35 | QWidget{ 36 | background-color: none; 37 | } 38 | 39 | /* LINE EDIT */ 40 | QLineEdit{ 41 | color: #000; 42 | background-color: #bbb; 43 | border: 2px solid #bbb; 44 | border-radius: 5px; 45 | selection-color: rgb(16, 16, 16); 46 | selection-background-color: rgb(221, 51, 34); 47 | font-family: Segoe UI; 48 | font-size: 11pt; 49 | } 50 | QLineEdit::focus{ 51 | border-color: #444; 52 | } 53 | 54 | /* PUSH BUTTON */ 55 | QPushButton{ 56 | border: 2px solid #777; 57 | border-radius: 5px; 58 | font-family: Segoe UI; 59 | font-size: 9pt; 60 | font-weight: bold; 61 | color: #333; 62 | width: 100px; 63 | } 64 | QPushButton:hover{ 65 | border: 2px solid #777; 66 | color: #111; 67 | background-color: #777; 68 | } 69 | QPushButton:pressed{ 70 | border: 2px solid #aaa; 71 | color: #222; 72 | background-color: #aaa; 73 | } 74 | 75 | 76 | 77 | 0 78 | 79 | 80 | 10 81 | 82 | 83 | 10 84 | 85 | 86 | 10 87 | 88 | 89 | 10 90 | 91 | 92 | 93 | 94 | QFrame{ 95 | background-color: #eee; 96 | border-radius: 10px; 97 | } 98 | 99 | 100 | QFrame::StyledPanel 101 | 102 | 103 | QFrame::Raised 104 | 105 | 106 | 107 | 10 108 | 109 | 110 | 0 111 | 112 | 113 | 0 114 | 115 | 116 | 0 117 | 118 | 119 | 0 120 | 121 | 122 | 123 | 124 | 125 | 0 126 | 32 127 | 128 | 129 | 130 | background-color: #bbb; 131 | 132 | 133 | QFrame::StyledPanel 134 | 135 | 136 | QFrame::Raised 137 | 138 | 139 | 140 | 5 141 | 142 | 143 | 10 144 | 145 | 146 | 0 147 | 148 | 149 | 10 150 | 151 | 152 | 0 153 | 154 | 155 | 156 | 157 | Qt::Horizontal 158 | 159 | 160 | QSizePolicy::Fixed 161 | 162 | 163 | 164 | 16 165 | 0 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 0 175 | 0 176 | 177 | 178 | 179 | 180 | 16777215 181 | 16777215 182 | 183 | 184 | 185 | QLabel{ 186 | color: #444; 187 | font-family: Segoe UI; 188 | font-size: 9pt; 189 | } 190 | 191 | 192 | <strong>COLOR</strong> PICKER 193 | 194 | 195 | Qt::AlignCenter 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 16 204 | 16 205 | 206 | 207 | 208 | 209 | 16 210 | 16 211 | 212 | 213 | 214 | Qt::NoFocus 215 | 216 | 217 | QPushButton{ 218 | border: none; 219 | background-color: #888; 220 | border-radius: 8px 221 | } 222 | QPushButton:hover{ 223 | background-color: #444; 224 | } 225 | 226 | 227 | 228 | 229 | 230 | 231 | :/img/exit.ico:/img/exit.ico 232 | 233 | 234 | 235 | 12 236 | 12 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | Qt::LeftToRight 248 | 249 | 250 | border-radius: 4px 251 | 252 | 253 | QFrame::StyledPanel 254 | 255 | 256 | QFrame::Raised 257 | 258 | 259 | 260 | 10 261 | 262 | 263 | 10 264 | 265 | 266 | 0 267 | 268 | 269 | 10 270 | 271 | 272 | 0 273 | 274 | 275 | 276 | 277 | 278 | 200 279 | 200 280 | 281 | 282 | 283 | 284 | 200 285 | 200 286 | 287 | 288 | 289 | /* ALL CHANGES HERE WILL BE OVERWRITTEN */; 290 | background-color: qlineargradient(x1:1, x2:0, stop:0 hsl(0%,100%,50%), stop:1 rgba(255, 255, 255, 255)); 291 | 292 | 293 | 294 | 295 | QFrame::StyledPanel 296 | 297 | 298 | QFrame::Raised 299 | 300 | 301 | 302 | 0 303 | 304 | 305 | 0 306 | 307 | 308 | 0 309 | 310 | 311 | 0 312 | 313 | 314 | 0 315 | 316 | 317 | 318 | 319 | background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 0), stop:1 rgba(0, 0, 0, 255)); 320 | border-radius: 4px; 321 | 322 | 323 | 324 | 325 | QFrame::StyledPanel 326 | 327 | 328 | QFrame::Raised 329 | 330 | 331 | 332 | 333 | 194 334 | 20 335 | 12 336 | 12 337 | 338 | 339 | 340 | 341 | 12 342 | 12 343 | 344 | 345 | 346 | 347 | 12 348 | 12 349 | 350 | 351 | 352 | background-color:none; 353 | border: 1px solid white; 354 | border-radius: 5px; 355 | 356 | 357 | QFrame::StyledPanel 358 | 359 | 360 | QFrame::Raised 361 | 362 | 363 | 364 | 365 | 1 366 | 1 367 | 10 368 | 10 369 | 370 | 371 | 372 | 373 | 10 374 | 10 375 | 376 | 377 | 378 | 379 | 10 380 | 10 381 | 382 | 383 | 384 | 385 | 10 386 | 10 387 | 388 | 389 | 390 | background-color: none; 391 | border: 1px solid black; 392 | border-radius: 5px; 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 40 409 | 0 410 | 411 | 412 | 413 | 414 | 415 | 416 | QFrame::StyledPanel 417 | 418 | 419 | QFrame::Raised 420 | 421 | 422 | 423 | 424 | 10 425 | 0 426 | 20 427 | 200 428 | 429 | 430 | 431 | 432 | 20 433 | 200 434 | 435 | 436 | 437 | background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(255, 0, 0, 255), stop:0.166 rgba(255, 255, 0, 255), stop:0.333 rgba(0, 255, 0, 255), stop:0.5 rgba(0, 255, 255, 255), stop:0.666 rgba(0, 0, 255, 255), stop:0.833 rgba(255, 0, 255, 255), stop:1 rgba(255, 0, 0, 255)); 438 | border-radius: 5px; 439 | 440 | 441 | QFrame::StyledPanel 442 | 443 | 444 | QFrame::Raised 445 | 446 | 447 | 448 | 449 | 450 | 7 451 | 185 452 | 26 453 | 15 454 | 455 | 456 | 457 | 458 | 26 459 | 0 460 | 461 | 462 | 463 | background-color: #222; 464 | border-radius: 5px; 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 7 474 | 0 475 | 26 476 | 200 477 | 478 | 479 | 480 | 481 | 20 482 | 200 483 | 484 | 485 | 486 | background-color: none; 487 | 488 | 489 | QFrame::StyledPanel 490 | 491 | 492 | QFrame::Raised 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 110 502 | 200 503 | 504 | 505 | 506 | 507 | 120 508 | 200 509 | 510 | 511 | 512 | QLabel{ 513 | font-family: Segoe UI; 514 | font-weight: bold; 515 | font-size: 11pt; 516 | color: #666; 517 | border-radius: 5px; 518 | } 519 | 520 | 521 | 522 | QFrame::StyledPanel 523 | 524 | 525 | QFrame::Raised 526 | 527 | 528 | 529 | 5 530 | 531 | 532 | 5 533 | 534 | 535 | 15 536 | 537 | 538 | 10 539 | 540 | 541 | 15 542 | 543 | 544 | 1 545 | 546 | 547 | 548 | 549 | 550 | 0 551 | 30 552 | 553 | 554 | 555 | /* ALL CHANGES HERE WILL BE OVERWRITTEN */; 556 | background-color: rgb(255, 255, 255); 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 0 569 | 30 570 | 571 | 572 | 573 | /* ALL CHANGES HERE WILL BE OVERWRITTEN */; 574 | background-color: rgb(0, 0, 0); 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | R 585 | 586 | 587 | red 588 | 589 | 590 | 591 | 592 | 593 | 594 | 255 595 | 596 | 597 | Qt::AlignCenter 598 | 599 | 600 | false 601 | 602 | 603 | 604 | 605 | 606 | 607 | G 608 | 609 | 610 | green 611 | 612 | 613 | 614 | 615 | 616 | 617 | 255 618 | 619 | 620 | Qt::AlignCenter 621 | 622 | 623 | 624 | 625 | 626 | 627 | B 628 | 629 | 630 | blue 631 | 632 | 633 | 634 | 635 | 636 | 637 | 255 638 | 639 | 640 | Qt::AlignCenter 641 | 642 | 643 | 644 | 645 | 646 | 647 | ffffff 648 | 649 | 650 | Qt::AlignCenter 651 | 652 | 653 | 654 | 655 | 656 | 657 | font-size: 14pt; 658 | 659 | 660 | # 661 | 662 | 663 | blue 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 0 678 | 0 679 | 680 | 681 | 682 | QFrame{ 683 | background-color: #ccc; 684 | padding: 5px 685 | } 686 | 687 | 688 | 689 | QFrame::StyledPanel 690 | 691 | 692 | QFrame::Raised 693 | 694 | 695 | 696 | 10 697 | 698 | 699 | 100 700 | 701 | 702 | 0 703 | 704 | 705 | 100 706 | 707 | 708 | 0 709 | 710 | 711 | 712 | 713 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 714 | 715 | 716 | true 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | red 731 | green 732 | blue 733 | 734 | 735 | 736 | 737 | 738 | 739 | -------------------------------------------------------------------------------- /vcolorpicker/ui/ui_light_alpha.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ColorPicker 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 400 22 | 300 23 | 24 | 25 | 26 | 27 | 400 28 | 300 29 | 30 | 31 | 32 | Form 33 | 34 | 35 | QWidget{ 36 | background-color: none; 37 | } 38 | 39 | /* LINE EDIT */ 40 | QLineEdit{ 41 | color: #000; 42 | background-color: #bbb; 43 | border: 2px solid #bbb; 44 | border-radius: 5px; 45 | selection-color: rgb(16, 16, 16); 46 | selection-background-color: rgb(221, 51, 34); 47 | font-family: Segoe UI; 48 | font-size: 11pt; 49 | } 50 | QLineEdit::focus{ 51 | border-color: #444; 52 | } 53 | 54 | /* PUSH BUTTON */ 55 | QPushButton{ 56 | border: 2px solid #777; 57 | border-radius: 5px; 58 | font-family: Segoe UI; 59 | font-size: 9pt; 60 | font-weight: bold; 61 | color: #333; 62 | width: 100px; 63 | } 64 | QPushButton:hover{ 65 | border: 2px solid #777; 66 | color: #111; 67 | background-color: #777; 68 | } 69 | QPushButton:pressed{ 70 | border: 2px solid #aaa; 71 | color: #222; 72 | background-color: #aaa; 73 | } 74 | 75 | 76 | 77 | 0 78 | 79 | 80 | 10 81 | 82 | 83 | 10 84 | 85 | 86 | 10 87 | 88 | 89 | 10 90 | 91 | 92 | 93 | 94 | QFrame{ 95 | background-color: #eee; 96 | border-radius: 10px; 97 | } 98 | 99 | 100 | QFrame::StyledPanel 101 | 102 | 103 | QFrame::Raised 104 | 105 | 106 | 107 | 10 108 | 109 | 110 | 0 111 | 112 | 113 | 0 114 | 115 | 116 | 0 117 | 118 | 119 | 0 120 | 121 | 122 | 123 | 124 | 125 | 0 126 | 32 127 | 128 | 129 | 130 | background-color: #bbb; 131 | 132 | 133 | QFrame::StyledPanel 134 | 135 | 136 | QFrame::Raised 137 | 138 | 139 | 140 | 5 141 | 142 | 143 | 10 144 | 145 | 146 | 0 147 | 148 | 149 | 10 150 | 151 | 152 | 0 153 | 154 | 155 | 156 | 157 | Qt::Horizontal 158 | 159 | 160 | QSizePolicy::Fixed 161 | 162 | 163 | 164 | 16 165 | 0 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 0 175 | 0 176 | 177 | 178 | 179 | 180 | 16777215 181 | 16777215 182 | 183 | 184 | 185 | QLabel{ 186 | color: #444; 187 | font-family: Segoe UI; 188 | font-size: 9pt; 189 | } 190 | 191 | 192 | <strong>COLOR</strong> PICKER 193 | 194 | 195 | Qt::AlignCenter 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 16 204 | 16 205 | 206 | 207 | 208 | 209 | 16 210 | 16 211 | 212 | 213 | 214 | Qt::NoFocus 215 | 216 | 217 | QPushButton{ 218 | border: none; 219 | background-color: #888; 220 | border-radius: 8px 221 | } 222 | QPushButton:hover{ 223 | background-color: #444; 224 | } 225 | 226 | 227 | 228 | 229 | 230 | 231 | :/img/exit.ico:/img/exit.ico 232 | 233 | 234 | 235 | 12 236 | 12 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | Qt::LeftToRight 248 | 249 | 250 | border-radius: 4px 251 | 252 | 253 | QFrame::StyledPanel 254 | 255 | 256 | QFrame::Raised 257 | 258 | 259 | 260 | 10 261 | 262 | 263 | 10 264 | 265 | 266 | 0 267 | 268 | 269 | 10 270 | 271 | 272 | 0 273 | 274 | 275 | 276 | 277 | 278 | 200 279 | 200 280 | 281 | 282 | 283 | 284 | 200 285 | 200 286 | 287 | 288 | 289 | /* ALL CHANGES HERE WILL BE OVERWRITTEN */; 290 | background-color: qlineargradient(x1:1, x2:0, stop:0 hsl(0%,100%,50%), stop:1 rgba(255, 255, 255, 255)); 291 | 292 | 293 | 294 | 295 | QFrame::StyledPanel 296 | 297 | 298 | QFrame::Raised 299 | 300 | 301 | 302 | 0 303 | 304 | 305 | 0 306 | 307 | 308 | 0 309 | 310 | 311 | 0 312 | 313 | 314 | 0 315 | 316 | 317 | 318 | 319 | background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 0), stop:1 rgba(0, 0, 0, 255)); 320 | border-radius: 4px; 321 | 322 | 323 | 324 | 325 | QFrame::StyledPanel 326 | 327 | 328 | QFrame::Raised 329 | 330 | 331 | 332 | 333 | 194 334 | 20 335 | 12 336 | 12 337 | 338 | 339 | 340 | 341 | 12 342 | 12 343 | 344 | 345 | 346 | 347 | 12 348 | 12 349 | 350 | 351 | 352 | background-color:none; 353 | border: 1px solid white; 354 | border-radius: 5px; 355 | 356 | 357 | QFrame::StyledPanel 358 | 359 | 360 | QFrame::Raised 361 | 362 | 363 | 364 | 365 | 1 366 | 1 367 | 10 368 | 10 369 | 370 | 371 | 372 | 373 | 10 374 | 10 375 | 376 | 377 | 378 | 379 | 10 380 | 10 381 | 382 | 383 | 384 | 385 | 10 386 | 10 387 | 388 | 389 | 390 | background-color: none; 391 | border: 1px solid black; 392 | border-radius: 5px; 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 40 409 | 0 410 | 411 | 412 | 413 | 414 | 415 | 416 | QFrame::StyledPanel 417 | 418 | 419 | QFrame::Raised 420 | 421 | 422 | 423 | 424 | 10 425 | 0 426 | 20 427 | 200 428 | 429 | 430 | 431 | 432 | 20 433 | 200 434 | 435 | 436 | 437 | background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(255, 0, 0, 255), stop:0.166 rgba(255, 255, 0, 255), stop:0.333 rgba(0, 255, 0, 255), stop:0.5 rgba(0, 255, 255, 255), stop:0.666 rgba(0, 0, 255, 255), stop:0.833 rgba(255, 0, 255, 255), stop:1 rgba(255, 0, 0, 255)); 438 | border-radius: 5px; 439 | 440 | 441 | QFrame::StyledPanel 442 | 443 | 444 | QFrame::Raised 445 | 446 | 447 | 448 | 449 | 450 | 7 451 | 185 452 | 26 453 | 15 454 | 455 | 456 | 457 | 458 | 26 459 | 0 460 | 461 | 462 | 463 | background-color: #222; 464 | border-radius: 5px; 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 7 474 | 0 475 | 26 476 | 200 477 | 478 | 479 | 480 | 481 | 20 482 | 200 483 | 484 | 485 | 486 | background-color: none; 487 | 488 | 489 | QFrame::StyledPanel 490 | 491 | 492 | QFrame::Raised 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 110 502 | 200 503 | 504 | 505 | 506 | 507 | 120 508 | 200 509 | 510 | 511 | 512 | QLabel{ 513 | font-family: Segoe UI; 514 | font-weight: bold; 515 | font-size: 11pt; 516 | color: #666; 517 | border-radius: 5px; 518 | } 519 | 520 | 521 | 522 | QFrame::StyledPanel 523 | 524 | 525 | QFrame::Raised 526 | 527 | 528 | 529 | 5 530 | 531 | 532 | 5 533 | 534 | 535 | 15 536 | 537 | 538 | 10 539 | 540 | 541 | 15 542 | 543 | 544 | 1 545 | 546 | 547 | 548 | 549 | 550 | 0 551 | 24 552 | 553 | 554 | 555 | /* ALL CHANGES HERE WILL BE OVERWRITTEN */; 556 | background-color: rgb(255, 255, 255); 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 0 569 | 24 570 | 571 | 572 | 573 | /* ALL CHANGES HERE WILL BE OVERWRITTEN */; 574 | background-color: rgb(0, 0, 0); 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | R 585 | 586 | 587 | red 588 | 589 | 590 | 591 | 592 | 593 | 594 | 255 595 | 596 | 597 | Qt::AlignCenter 598 | 599 | 600 | false 601 | 602 | 603 | 604 | 605 | 606 | 607 | G 608 | 609 | 610 | green 611 | 612 | 613 | 614 | 615 | 616 | 617 | 255 618 | 619 | 620 | Qt::AlignCenter 621 | 622 | 623 | 624 | 625 | 626 | 627 | B 628 | 629 | 630 | blue 631 | 632 | 633 | 634 | 635 | 636 | 637 | 255 638 | 639 | 640 | Qt::AlignCenter 641 | 642 | 643 | 644 | 645 | 646 | 647 | ffffff 648 | 649 | 650 | Qt::AlignCenter 651 | 652 | 653 | 654 | 655 | 656 | 657 | font-size: 14pt; 658 | 659 | 660 | # 661 | 662 | 663 | blue 664 | 665 | 666 | 667 | 668 | 669 | 670 | 255 671 | 672 | 673 | Qt::AlignCenter 674 | 675 | 676 | 677 | 678 | 679 | 680 | A 681 | 682 | 683 | blue 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 0 698 | 0 699 | 700 | 701 | 702 | QFrame{ 703 | background-color: #ccc; 704 | padding: 5px 705 | } 706 | 707 | 708 | 709 | QFrame::StyledPanel 710 | 711 | 712 | QFrame::Raised 713 | 714 | 715 | 716 | 10 717 | 718 | 719 | 100 720 | 721 | 722 | 0 723 | 724 | 725 | 100 726 | 727 | 728 | 0 729 | 730 | 731 | 732 | 733 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 734 | 735 | 736 | true 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | red 751 | green 752 | blue 753 | 754 | 755 | 756 | 757 | 758 | 759 | -------------------------------------------------------------------------------- /vcolorpicker/ui_dark.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'D:/Files/Code/repos/pyqt-vcolorpicker/vcolorpicker/ui/ui_dark.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.0 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from qtpy import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_ColorPicker(object): 15 | def setupUi(self, ColorPicker): 16 | ColorPicker.setObjectName("ColorPicker") 17 | ColorPicker.resize(400, 300) 18 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) 19 | sizePolicy.setHorizontalStretch(0) 20 | sizePolicy.setVerticalStretch(0) 21 | sizePolicy.setHeightForWidth(ColorPicker.sizePolicy().hasHeightForWidth()) 22 | ColorPicker.setSizePolicy(sizePolicy) 23 | ColorPicker.setMinimumSize(QtCore.QSize(400, 300)) 24 | ColorPicker.setMaximumSize(QtCore.QSize(400, 300)) 25 | ColorPicker.setStyleSheet("QWidget{\n" 26 | " background-color: none;\n" 27 | "}\n" 28 | "\n" 29 | "/* LINE EDIT */\n" 30 | "QLineEdit{\n" 31 | " color: rgb(221, 221, 221);\n" 32 | " background-color: #303030;\n" 33 | " border: 2px solid #303030;\n" 34 | " border-radius: 5px;\n" 35 | " selection-color: rgb(16, 16, 16);\n" 36 | " selection-background-color: rgb(221, 51, 34);\n" 37 | " font-family: Segoe UI;\n" 38 | " font-size: 11pt;\n" 39 | "}\n" 40 | "QLineEdit::focus{\n" 41 | " border-color: #aaaaaa;\n" 42 | "}\n" 43 | "\n" 44 | "/* PUSH BUTTON */\n" 45 | "QPushButton{\n" 46 | " border: 2px solid #aaa;\n" 47 | " border-radius: 5px;\n" 48 | " font-family: Segoe UI;\n" 49 | " font-size: 9pt;\n" 50 | " font-weight: bold;\n" 51 | " color: #ccc;\n" 52 | " width: 100px;\n" 53 | "}\n" 54 | "QPushButton:hover{\n" 55 | " border: 2px solid #aaa;\n" 56 | " color: #222;\n" 57 | " background-color: #aaa;\n" 58 | "}\n" 59 | "QPushButton:pressed{\n" 60 | " border: 2px solid #aaa;\n" 61 | " color: #222;\n" 62 | " background-color: #aaa;\n" 63 | "}") 64 | self.verticalLayout = QtWidgets.QVBoxLayout(ColorPicker) 65 | self.verticalLayout.setContentsMargins(10, 10, 10, 10) 66 | self.verticalLayout.setSpacing(0) 67 | self.verticalLayout.setObjectName("verticalLayout") 68 | self.drop_shadow_frame = QtWidgets.QFrame(ColorPicker) 69 | self.drop_shadow_frame.setStyleSheet("QFrame{\n" 70 | "background-color: #202020;\n" 71 | "border-radius: 10px;\n" 72 | "}") 73 | self.drop_shadow_frame.setFrameShape(QtWidgets.QFrame.StyledPanel) 74 | self.drop_shadow_frame.setFrameShadow(QtWidgets.QFrame.Raised) 75 | self.drop_shadow_frame.setObjectName("drop_shadow_frame") 76 | self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.drop_shadow_frame) 77 | self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) 78 | self.verticalLayout_3.setSpacing(10) 79 | self.verticalLayout_3.setObjectName("verticalLayout_3") 80 | self.title_bar = QtWidgets.QFrame(self.drop_shadow_frame) 81 | self.title_bar.setMinimumSize(QtCore.QSize(0, 32)) 82 | self.title_bar.setStyleSheet("background-color: rgb(48, 48, 48);") 83 | self.title_bar.setFrameShape(QtWidgets.QFrame.StyledPanel) 84 | self.title_bar.setFrameShadow(QtWidgets.QFrame.Raised) 85 | self.title_bar.setObjectName("title_bar") 86 | self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.title_bar) 87 | self.horizontalLayout_2.setContentsMargins(10, 0, 10, 0) 88 | self.horizontalLayout_2.setSpacing(5) 89 | self.horizontalLayout_2.setObjectName("horizontalLayout_2") 90 | spacerItem = QtWidgets.QSpacerItem(16, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) 91 | self.horizontalLayout_2.addItem(spacerItem) 92 | self.window_title = QtWidgets.QLabel(self.title_bar) 93 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) 94 | sizePolicy.setHorizontalStretch(0) 95 | sizePolicy.setVerticalStretch(0) 96 | sizePolicy.setHeightForWidth(self.window_title.sizePolicy().hasHeightForWidth()) 97 | self.window_title.setSizePolicy(sizePolicy) 98 | self.window_title.setMaximumSize(QtCore.QSize(16777215, 16777215)) 99 | self.window_title.setStyleSheet("QLabel{\n" 100 | " color: #fff;\n" 101 | " font-family: Segoe UI;\n" 102 | " font-size: 9pt;\n" 103 | "}") 104 | self.window_title.setAlignment(QtCore.Qt.AlignCenter) 105 | self.window_title.setObjectName("window_title") 106 | self.horizontalLayout_2.addWidget(self.window_title) 107 | self.exit_btn = QtWidgets.QPushButton(self.title_bar) 108 | self.exit_btn.setMinimumSize(QtCore.QSize(16, 16)) 109 | self.exit_btn.setMaximumSize(QtCore.QSize(16, 16)) 110 | self.exit_btn.setFocusPolicy(QtCore.Qt.NoFocus) 111 | self.exit_btn.setStyleSheet("QPushButton{\n" 112 | " border: none;\n" 113 | " background-color: #aaaaaa;\n" 114 | " border-radius: 8px\n" 115 | "}\n" 116 | "QPushButton:hover{\n" 117 | " background-color: #666666;\n" 118 | "}") 119 | self.exit_btn.setText("") 120 | icon = QtGui.QIcon() 121 | icon.addPixmap(QtGui.QPixmap(":/img/exit.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) 122 | self.exit_btn.setIcon(icon) 123 | self.exit_btn.setIconSize(QtCore.QSize(12, 12)) 124 | self.exit_btn.setObjectName("exit_btn") 125 | self.horizontalLayout_2.addWidget(self.exit_btn) 126 | self.verticalLayout_3.addWidget(self.title_bar) 127 | self.content_bar = QtWidgets.QFrame(self.drop_shadow_frame) 128 | self.content_bar.setLayoutDirection(QtCore.Qt.LeftToRight) 129 | self.content_bar.setStyleSheet("QWidget{\n" 130 | "border-radius: 5px\n" 131 | "}\n" 132 | "#color_view{\n" 133 | " border-bottom-left-radius: 7px;\n" 134 | " border-bottom-right-radius: 7px;\n" 135 | "}\n" 136 | "#black_overlay{\n" 137 | " border-bottom-left-radius: 6px;\n" 138 | " border-bottom-right-radius: 6px;\n" 139 | "}") 140 | self.content_bar.setFrameShape(QtWidgets.QFrame.StyledPanel) 141 | self.content_bar.setFrameShadow(QtWidgets.QFrame.Raised) 142 | self.content_bar.setObjectName("content_bar") 143 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.content_bar) 144 | self.horizontalLayout.setContentsMargins(10, 0, 10, 0) 145 | self.horizontalLayout.setSpacing(10) 146 | self.horizontalLayout.setObjectName("horizontalLayout") 147 | self.color_view = QtWidgets.QFrame(self.content_bar) 148 | self.color_view.setMinimumSize(QtCore.QSize(200, 200)) 149 | self.color_view.setMaximumSize(QtCore.QSize(200, 200)) 150 | self.color_view.setStyleSheet("/* ALL CHANGES HERE WILL BE OVERWRITTEN */;\n" 151 | "background-color: qlineargradient(x1:1, x2:0, stop:0 hsl(0%,100%,50%), stop:1 rgba(255, 255, 255, 255));\n" 152 | "\n" 153 | "") 154 | self.color_view.setFrameShape(QtWidgets.QFrame.StyledPanel) 155 | self.color_view.setFrameShadow(QtWidgets.QFrame.Raised) 156 | self.color_view.setObjectName("color_view") 157 | self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.color_view) 158 | self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) 159 | self.verticalLayout_2.setSpacing(0) 160 | self.verticalLayout_2.setObjectName("verticalLayout_2") 161 | self.black_overlay = QtWidgets.QFrame(self.color_view) 162 | self.black_overlay.setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 0), stop:1 rgba(0, 0, 0, 255));\n" 163 | "\n" 164 | "\n" 165 | "") 166 | self.black_overlay.setFrameShape(QtWidgets.QFrame.StyledPanel) 167 | self.black_overlay.setFrameShadow(QtWidgets.QFrame.Raised) 168 | self.black_overlay.setObjectName("black_overlay") 169 | self.selector = QtWidgets.QFrame(self.black_overlay) 170 | self.selector.setGeometry(QtCore.QRect(194, 20, 12, 12)) 171 | self.selector.setMinimumSize(QtCore.QSize(12, 12)) 172 | self.selector.setMaximumSize(QtCore.QSize(12, 12)) 173 | self.selector.setStyleSheet("background-color:none;\n" 174 | "border: 1px solid white;\n" 175 | "border-radius: 5px;") 176 | self.selector.setFrameShape(QtWidgets.QFrame.StyledPanel) 177 | self.selector.setFrameShadow(QtWidgets.QFrame.Raised) 178 | self.selector.setObjectName("selector") 179 | self.black_ring = QtWidgets.QLabel(self.selector) 180 | self.black_ring.setGeometry(QtCore.QRect(1, 1, 10, 10)) 181 | self.black_ring.setMinimumSize(QtCore.QSize(10, 10)) 182 | self.black_ring.setMaximumSize(QtCore.QSize(10, 10)) 183 | self.black_ring.setBaseSize(QtCore.QSize(10, 10)) 184 | self.black_ring.setStyleSheet("background-color: none;\n" 185 | "border: 1px solid black;\n" 186 | "border-radius: 5px;") 187 | self.black_ring.setText("") 188 | self.black_ring.setObjectName("black_ring") 189 | self.verticalLayout_2.addWidget(self.black_overlay) 190 | self.horizontalLayout.addWidget(self.color_view) 191 | self.frame_2 = QtWidgets.QFrame(self.content_bar) 192 | self.frame_2.setMinimumSize(QtCore.QSize(40, 0)) 193 | self.frame_2.setStyleSheet("") 194 | self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel) 195 | self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised) 196 | self.frame_2.setObjectName("frame_2") 197 | self.hue_bg = QtWidgets.QFrame(self.frame_2) 198 | self.hue_bg.setGeometry(QtCore.QRect(10, 0, 20, 200)) 199 | self.hue_bg.setMinimumSize(QtCore.QSize(20, 200)) 200 | self.hue_bg.setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(255, 0, 0, 255), stop:0.166 rgba(255, 255, 0, 255), stop:0.333 rgba(0, 255, 0, 255), stop:0.5 rgba(0, 255, 255, 255), stop:0.666 rgba(0, 0, 255, 255), stop:0.833 rgba(255, 0, 255, 255), stop:1 rgba(255, 0, 0, 255));\n" 201 | "border-radius: 5px;") 202 | self.hue_bg.setFrameShape(QtWidgets.QFrame.StyledPanel) 203 | self.hue_bg.setFrameShadow(QtWidgets.QFrame.Raised) 204 | self.hue_bg.setObjectName("hue_bg") 205 | self.hue_selector = QtWidgets.QLabel(self.frame_2) 206 | self.hue_selector.setGeometry(QtCore.QRect(7, 185, 26, 15)) 207 | self.hue_selector.setMinimumSize(QtCore.QSize(26, 0)) 208 | self.hue_selector.setStyleSheet("background-color: #aaa;\n" 209 | "border-radius: 5px;") 210 | self.hue_selector.setText("") 211 | self.hue_selector.setObjectName("hue_selector") 212 | self.hue = QtWidgets.QFrame(self.frame_2) 213 | self.hue.setGeometry(QtCore.QRect(7, 0, 26, 200)) 214 | self.hue.setMinimumSize(QtCore.QSize(20, 200)) 215 | self.hue.setStyleSheet("background-color: none;") 216 | self.hue.setFrameShape(QtWidgets.QFrame.StyledPanel) 217 | self.hue.setFrameShadow(QtWidgets.QFrame.Raised) 218 | self.hue.setObjectName("hue") 219 | self.horizontalLayout.addWidget(self.frame_2) 220 | self.editfields = QtWidgets.QFrame(self.content_bar) 221 | self.editfields.setMinimumSize(QtCore.QSize(110, 200)) 222 | self.editfields.setMaximumSize(QtCore.QSize(120, 200)) 223 | self.editfields.setStyleSheet("QLabel{\n" 224 | " font-family: Segoe UI;\n" 225 | "font-weight: bold;\n" 226 | " font-size: 11pt;\n" 227 | " color: #aaaaaa;\n" 228 | " border-radius: 5px;\n" 229 | "}\n" 230 | "") 231 | self.editfields.setFrameShape(QtWidgets.QFrame.StyledPanel) 232 | self.editfields.setFrameShadow(QtWidgets.QFrame.Raised) 233 | self.editfields.setObjectName("editfields") 234 | self.formLayout = QtWidgets.QFormLayout(self.editfields) 235 | self.formLayout.setContentsMargins(15, 0, 15, 1) 236 | self.formLayout.setSpacing(5) 237 | self.formLayout.setObjectName("formLayout") 238 | self.color_vis = QtWidgets.QLabel(self.editfields) 239 | self.color_vis.setMinimumSize(QtCore.QSize(0, 24)) 240 | self.color_vis.setStyleSheet("/* ALL CHANGES HERE WILL BE OVERWRITTEN */;\n" 241 | "background-color: rgb(255, 255, 255);\n" 242 | "") 243 | self.color_vis.setText("") 244 | self.color_vis.setObjectName("color_vis") 245 | self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.color_vis) 246 | self.lastcolor_vis = QtWidgets.QLabel(self.editfields) 247 | self.lastcolor_vis.setMinimumSize(QtCore.QSize(0, 24)) 248 | self.lastcolor_vis.setStyleSheet("/* ALL CHANGES HERE WILL BE OVERWRITTEN */;\n" 249 | "background-color: rgb(0, 0, 0);") 250 | self.lastcolor_vis.setText("") 251 | self.lastcolor_vis.setObjectName("lastcolor_vis") 252 | self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.lastcolor_vis) 253 | self.lbl_red = QtWidgets.QLabel(self.editfields) 254 | self.lbl_red.setObjectName("lbl_red") 255 | self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.lbl_red) 256 | self.red = QtWidgets.QLineEdit(self.editfields) 257 | self.red.setAlignment(QtCore.Qt.AlignCenter) 258 | self.red.setClearButtonEnabled(False) 259 | self.red.setObjectName("red") 260 | self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.red) 261 | self.lbl_green = QtWidgets.QLabel(self.editfields) 262 | self.lbl_green.setObjectName("lbl_green") 263 | self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.lbl_green) 264 | self.green = QtWidgets.QLineEdit(self.editfields) 265 | self.green.setAlignment(QtCore.Qt.AlignCenter) 266 | self.green.setObjectName("green") 267 | self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.green) 268 | self.lbl_blue = QtWidgets.QLabel(self.editfields) 269 | self.lbl_blue.setObjectName("lbl_blue") 270 | self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.lbl_blue) 271 | self.blue = QtWidgets.QLineEdit(self.editfields) 272 | self.blue.setAlignment(QtCore.Qt.AlignCenter) 273 | self.blue.setObjectName("blue") 274 | self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.blue) 275 | self.lbl_hex = QtWidgets.QLabel(self.editfields) 276 | self.lbl_hex.setStyleSheet("font-size: 14pt;") 277 | self.lbl_hex.setObjectName("lbl_hex") 278 | self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.lbl_hex) 279 | self.hex = QtWidgets.QLineEdit(self.editfields) 280 | self.hex.setAlignment(QtCore.Qt.AlignCenter) 281 | self.hex.setObjectName("hex") 282 | self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.hex) 283 | self.horizontalLayout.addWidget(self.editfields) 284 | self.verticalLayout_3.addWidget(self.content_bar) 285 | self.button_bar = QtWidgets.QFrame(self.drop_shadow_frame) 286 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) 287 | sizePolicy.setHorizontalStretch(0) 288 | sizePolicy.setVerticalStretch(0) 289 | sizePolicy.setHeightForWidth(self.button_bar.sizePolicy().hasHeightForWidth()) 290 | self.button_bar.setSizePolicy(sizePolicy) 291 | self.button_bar.setStyleSheet("QFrame{\n" 292 | "background-color: #1d1d1d;\n" 293 | "padding: 5px\n" 294 | "}\n" 295 | "") 296 | self.button_bar.setFrameShape(QtWidgets.QFrame.StyledPanel) 297 | self.button_bar.setFrameShadow(QtWidgets.QFrame.Raised) 298 | self.button_bar.setObjectName("button_bar") 299 | self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.button_bar) 300 | self.horizontalLayout_3.setContentsMargins(100, 0, 100, 0) 301 | self.horizontalLayout_3.setSpacing(10) 302 | self.horizontalLayout_3.setObjectName("horizontalLayout_3") 303 | self.buttonBox = QtWidgets.QDialogButtonBox(self.button_bar) 304 | self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) 305 | self.buttonBox.setCenterButtons(True) 306 | self.buttonBox.setObjectName("buttonBox") 307 | self.horizontalLayout_3.addWidget(self.buttonBox) 308 | self.verticalLayout_3.addWidget(self.button_bar) 309 | self.verticalLayout.addWidget(self.drop_shadow_frame) 310 | self.lbl_red.setBuddy(self.red) 311 | self.lbl_green.setBuddy(self.green) 312 | self.lbl_blue.setBuddy(self.blue) 313 | self.lbl_hex.setBuddy(self.blue) 314 | 315 | self.retranslateUi(ColorPicker) 316 | QtCore.QMetaObject.connectSlotsByName(ColorPicker) 317 | ColorPicker.setTabOrder(self.red, self.green) 318 | ColorPicker.setTabOrder(self.green, self.blue) 319 | 320 | def retranslateUi(self, ColorPicker): 321 | _translate = QtCore.QCoreApplication.translate 322 | ColorPicker.setWindowTitle(_translate("ColorPicker", "Form")) 323 | self.window_title.setText(_translate("ColorPicker", "COLOR PICKER")) 324 | self.lbl_red.setText(_translate("ColorPicker", "R")) 325 | self.red.setText(_translate("ColorPicker", "255")) 326 | self.lbl_green.setText(_translate("ColorPicker", "G")) 327 | self.green.setText(_translate("ColorPicker", "255")) 328 | self.lbl_blue.setText(_translate("ColorPicker", "B")) 329 | self.blue.setText(_translate("ColorPicker", "255")) 330 | self.lbl_hex.setText(_translate("ColorPicker", "#")) 331 | self.hex.setText(_translate("ColorPicker", "ffffff")) 332 | -------------------------------------------------------------------------------- /vcolorpicker/ui_dark_alpha.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'ui_dark_alpha.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.0 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from qtpy import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_ColorPicker(object): 15 | def setupUi(self, ColorPicker): 16 | ColorPicker.setObjectName("ColorPicker") 17 | ColorPicker.resize(400, 300) 18 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) 19 | sizePolicy.setHorizontalStretch(0) 20 | sizePolicy.setVerticalStretch(0) 21 | sizePolicy.setHeightForWidth(ColorPicker.sizePolicy().hasHeightForWidth()) 22 | ColorPicker.setSizePolicy(sizePolicy) 23 | ColorPicker.setMinimumSize(QtCore.QSize(400, 300)) 24 | ColorPicker.setMaximumSize(QtCore.QSize(400, 300)) 25 | ColorPicker.setStyleSheet("QWidget{\n" 26 | " background-color: none;\n" 27 | "}\n" 28 | "\n" 29 | "/* LINE EDIT */\n" 30 | "QLineEdit{\n" 31 | " color: rgb(221, 221, 221);\n" 32 | " background-color: #303030;\n" 33 | " border: 2px solid #303030;\n" 34 | " border-radius: 5px;\n" 35 | " selection-color: rgb(16, 16, 16);\n" 36 | " selection-background-color: rgb(221, 51, 34);\n" 37 | " font-family: Segoe UI;\n" 38 | " font-size: 11pt;\n" 39 | "}\n" 40 | "QLineEdit::focus{\n" 41 | " border-color: #aaaaaa;\n" 42 | "}\n" 43 | "\n" 44 | "/* PUSH BUTTON */\n" 45 | "QPushButton{\n" 46 | " border: 2px solid #aaa;\n" 47 | " border-radius: 5px;\n" 48 | " font-family: Segoe UI;\n" 49 | " font-size: 9pt;\n" 50 | " font-weight: bold;\n" 51 | " color: #ccc;\n" 52 | " width: 100px;\n" 53 | "}\n" 54 | "QPushButton:hover{\n" 55 | " border: 2px solid #aaa;\n" 56 | " color: #222;\n" 57 | " background-color: #aaa;\n" 58 | "}\n" 59 | "QPushButton:pressed{\n" 60 | " border: 2px solid #aaa;\n" 61 | " color: #222;\n" 62 | " background-color: #aaa;\n" 63 | "}") 64 | self.verticalLayout = QtWidgets.QVBoxLayout(ColorPicker) 65 | self.verticalLayout.setContentsMargins(10, 10, 10, 10) 66 | self.verticalLayout.setSpacing(0) 67 | self.verticalLayout.setObjectName("verticalLayout") 68 | self.drop_shadow_frame = QtWidgets.QFrame(ColorPicker) 69 | self.drop_shadow_frame.setStyleSheet("QFrame{\n" 70 | "background-color: #202020;\n" 71 | "border-radius: 10px;\n" 72 | "}") 73 | self.drop_shadow_frame.setFrameShape(QtWidgets.QFrame.StyledPanel) 74 | self.drop_shadow_frame.setFrameShadow(QtWidgets.QFrame.Raised) 75 | self.drop_shadow_frame.setObjectName("drop_shadow_frame") 76 | self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.drop_shadow_frame) 77 | self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) 78 | self.verticalLayout_3.setSpacing(10) 79 | self.verticalLayout_3.setObjectName("verticalLayout_3") 80 | self.title_bar = QtWidgets.QFrame(self.drop_shadow_frame) 81 | self.title_bar.setMinimumSize(QtCore.QSize(0, 32)) 82 | self.title_bar.setStyleSheet("background-color: rgb(48, 48, 48);") 83 | self.title_bar.setFrameShape(QtWidgets.QFrame.StyledPanel) 84 | self.title_bar.setFrameShadow(QtWidgets.QFrame.Raised) 85 | self.title_bar.setObjectName("title_bar") 86 | self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.title_bar) 87 | self.horizontalLayout_2.setContentsMargins(10, 0, 10, 0) 88 | self.horizontalLayout_2.setSpacing(5) 89 | self.horizontalLayout_2.setObjectName("horizontalLayout_2") 90 | spacerItem = QtWidgets.QSpacerItem(16, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) 91 | self.horizontalLayout_2.addItem(spacerItem) 92 | self.window_title = QtWidgets.QLabel(self.title_bar) 93 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) 94 | sizePolicy.setHorizontalStretch(0) 95 | sizePolicy.setVerticalStretch(0) 96 | sizePolicy.setHeightForWidth(self.window_title.sizePolicy().hasHeightForWidth()) 97 | self.window_title.setSizePolicy(sizePolicy) 98 | self.window_title.setMaximumSize(QtCore.QSize(16777215, 16777215)) 99 | self.window_title.setStyleSheet("QLabel{\n" 100 | " color: #fff;\n" 101 | " font-family: Segoe UI;\n" 102 | " font-size: 9pt;\n" 103 | "}") 104 | self.window_title.setAlignment(QtCore.Qt.AlignCenter) 105 | self.window_title.setObjectName("window_title") 106 | self.horizontalLayout_2.addWidget(self.window_title) 107 | self.exit_btn = QtWidgets.QPushButton(self.title_bar) 108 | self.exit_btn.setMinimumSize(QtCore.QSize(16, 16)) 109 | self.exit_btn.setMaximumSize(QtCore.QSize(16, 16)) 110 | self.exit_btn.setFocusPolicy(QtCore.Qt.NoFocus) 111 | self.exit_btn.setStyleSheet("QPushButton{\n" 112 | " border: none;\n" 113 | " background-color: #aaaaaa;\n" 114 | " border-radius: 8px\n" 115 | "}\n" 116 | "QPushButton:hover{\n" 117 | " background-color: #666666;\n" 118 | "}") 119 | self.exit_btn.setText("") 120 | icon = QtGui.QIcon() 121 | icon.addPixmap(QtGui.QPixmap(":/img/exit.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) 122 | self.exit_btn.setIcon(icon) 123 | self.exit_btn.setIconSize(QtCore.QSize(12, 12)) 124 | self.exit_btn.setObjectName("exit_btn") 125 | self.horizontalLayout_2.addWidget(self.exit_btn) 126 | self.verticalLayout_3.addWidget(self.title_bar) 127 | self.content_bar = QtWidgets.QFrame(self.drop_shadow_frame) 128 | self.content_bar.setLayoutDirection(QtCore.Qt.LeftToRight) 129 | self.content_bar.setStyleSheet("QWidget{\n" 130 | "border-radius: 5px\n" 131 | "}\n" 132 | "#color_view{\n" 133 | " border-bottom-left-radius: 7px;\n" 134 | " border-bottom-right-radius: 7px;\n" 135 | "}\n" 136 | "#black_overlay{\n" 137 | " border-bottom-left-radius: 6px;\n" 138 | " border-bottom-right-radius: 6px;\n" 139 | "}") 140 | self.content_bar.setFrameShape(QtWidgets.QFrame.StyledPanel) 141 | self.content_bar.setFrameShadow(QtWidgets.QFrame.Raised) 142 | self.content_bar.setObjectName("content_bar") 143 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.content_bar) 144 | self.horizontalLayout.setContentsMargins(10, 0, 10, 0) 145 | self.horizontalLayout.setSpacing(10) 146 | self.horizontalLayout.setObjectName("horizontalLayout") 147 | self.color_view = QtWidgets.QFrame(self.content_bar) 148 | self.color_view.setMinimumSize(QtCore.QSize(200, 200)) 149 | self.color_view.setMaximumSize(QtCore.QSize(200, 200)) 150 | self.color_view.setStyleSheet("/* ALL CHANGES HERE WILL BE OVERWRITTEN */;\n" 151 | "background-color: qlineargradient(x1:1, x2:0, stop:0 hsl(0%,100%,50%), stop:1 rgba(255, 255, 255, 255));\n" 152 | "\n" 153 | "") 154 | self.color_view.setFrameShape(QtWidgets.QFrame.StyledPanel) 155 | self.color_view.setFrameShadow(QtWidgets.QFrame.Raised) 156 | self.color_view.setObjectName("color_view") 157 | self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.color_view) 158 | self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) 159 | self.verticalLayout_2.setSpacing(0) 160 | self.verticalLayout_2.setObjectName("verticalLayout_2") 161 | self.black_overlay = QtWidgets.QFrame(self.color_view) 162 | self.black_overlay.setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 0), stop:1 rgba(0, 0, 0, 255));\n" 163 | "\n" 164 | "\n" 165 | "") 166 | self.black_overlay.setFrameShape(QtWidgets.QFrame.StyledPanel) 167 | self.black_overlay.setFrameShadow(QtWidgets.QFrame.Raised) 168 | self.black_overlay.setObjectName("black_overlay") 169 | self.selector = QtWidgets.QFrame(self.black_overlay) 170 | self.selector.setGeometry(QtCore.QRect(194, 20, 12, 12)) 171 | self.selector.setMinimumSize(QtCore.QSize(12, 12)) 172 | self.selector.setMaximumSize(QtCore.QSize(12, 12)) 173 | self.selector.setStyleSheet("background-color:none;\n" 174 | "border: 1px solid white;\n" 175 | "border-radius: 5px;") 176 | self.selector.setFrameShape(QtWidgets.QFrame.StyledPanel) 177 | self.selector.setFrameShadow(QtWidgets.QFrame.Raised) 178 | self.selector.setObjectName("selector") 179 | self.black_ring = QtWidgets.QLabel(self.selector) 180 | self.black_ring.setGeometry(QtCore.QRect(1, 1, 10, 10)) 181 | self.black_ring.setMinimumSize(QtCore.QSize(10, 10)) 182 | self.black_ring.setMaximumSize(QtCore.QSize(10, 10)) 183 | self.black_ring.setBaseSize(QtCore.QSize(10, 10)) 184 | self.black_ring.setStyleSheet("background-color: none;\n" 185 | "border: 1px solid black;\n" 186 | "border-radius: 5px;") 187 | self.black_ring.setText("") 188 | self.black_ring.setObjectName("black_ring") 189 | self.verticalLayout_2.addWidget(self.black_overlay) 190 | self.horizontalLayout.addWidget(self.color_view) 191 | self.frame_2 = QtWidgets.QFrame(self.content_bar) 192 | self.frame_2.setMinimumSize(QtCore.QSize(40, 0)) 193 | self.frame_2.setStyleSheet("") 194 | self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel) 195 | self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised) 196 | self.frame_2.setObjectName("frame_2") 197 | self.hue_bg = QtWidgets.QFrame(self.frame_2) 198 | self.hue_bg.setGeometry(QtCore.QRect(10, 0, 20, 200)) 199 | self.hue_bg.setMinimumSize(QtCore.QSize(20, 200)) 200 | self.hue_bg.setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(255, 0, 0, 255), stop:0.166 rgba(255, 255, 0, 255), stop:0.333 rgba(0, 255, 0, 255), stop:0.5 rgba(0, 255, 255, 255), stop:0.666 rgba(0, 0, 255, 255), stop:0.833 rgba(255, 0, 255, 255), stop:1 rgba(255, 0, 0, 255));\n" 201 | "border-radius: 5px;") 202 | self.hue_bg.setFrameShape(QtWidgets.QFrame.StyledPanel) 203 | self.hue_bg.setFrameShadow(QtWidgets.QFrame.Raised) 204 | self.hue_bg.setObjectName("hue_bg") 205 | self.hue_selector = QtWidgets.QLabel(self.frame_2) 206 | self.hue_selector.setGeometry(QtCore.QRect(7, 185, 26, 15)) 207 | self.hue_selector.setMinimumSize(QtCore.QSize(26, 0)) 208 | self.hue_selector.setStyleSheet("background-color: #aaa;\n" 209 | "border-radius: 5px;") 210 | self.hue_selector.setText("") 211 | self.hue_selector.setObjectName("hue_selector") 212 | self.hue = QtWidgets.QFrame(self.frame_2) 213 | self.hue.setGeometry(QtCore.QRect(7, 0, 26, 200)) 214 | self.hue.setMinimumSize(QtCore.QSize(20, 200)) 215 | self.hue.setStyleSheet("background-color: none;") 216 | self.hue.setFrameShape(QtWidgets.QFrame.StyledPanel) 217 | self.hue.setFrameShadow(QtWidgets.QFrame.Raised) 218 | self.hue.setObjectName("hue") 219 | self.horizontalLayout.addWidget(self.frame_2) 220 | self.editfields = QtWidgets.QFrame(self.content_bar) 221 | self.editfields.setMinimumSize(QtCore.QSize(110, 200)) 222 | self.editfields.setMaximumSize(QtCore.QSize(120, 200)) 223 | self.editfields.setStyleSheet("QLabel{\n" 224 | " font-family: Segoe UI;\n" 225 | "font-weight: bold;\n" 226 | " font-size: 11pt;\n" 227 | " color: #aaaaaa;\n" 228 | " border-radius: 5px;\n" 229 | "}\n" 230 | "") 231 | self.editfields.setFrameShape(QtWidgets.QFrame.StyledPanel) 232 | self.editfields.setFrameShadow(QtWidgets.QFrame.Raised) 233 | self.editfields.setObjectName("editfields") 234 | self.formLayout = QtWidgets.QFormLayout(self.editfields) 235 | self.formLayout.setContentsMargins(15, 0, 15, 1) 236 | self.formLayout.setSpacing(5) 237 | self.formLayout.setObjectName("formLayout") 238 | self.color_vis = QtWidgets.QLabel(self.editfields) 239 | self.color_vis.setMinimumSize(QtCore.QSize(0, 24)) 240 | self.color_vis.setStyleSheet("/* ALL CHANGES HERE WILL BE OVERWRITTEN */;\n" 241 | "background-color: rgb(255, 255, 255);\n" 242 | "") 243 | self.color_vis.setText("") 244 | self.color_vis.setObjectName("color_vis") 245 | self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.color_vis) 246 | self.lastcolor_vis = QtWidgets.QLabel(self.editfields) 247 | self.lastcolor_vis.setMinimumSize(QtCore.QSize(0, 24)) 248 | self.lastcolor_vis.setStyleSheet("/* ALL CHANGES HERE WILL BE OVERWRITTEN */;\n" 249 | "background-color: rgb(0, 0, 0);") 250 | self.lastcolor_vis.setText("") 251 | self.lastcolor_vis.setObjectName("lastcolor_vis") 252 | self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.lastcolor_vis) 253 | self.lbl_red = QtWidgets.QLabel(self.editfields) 254 | self.lbl_red.setObjectName("lbl_red") 255 | self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.lbl_red) 256 | self.red = QtWidgets.QLineEdit(self.editfields) 257 | self.red.setAlignment(QtCore.Qt.AlignCenter) 258 | self.red.setClearButtonEnabled(False) 259 | self.red.setObjectName("red") 260 | self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.red) 261 | self.lbl_green = QtWidgets.QLabel(self.editfields) 262 | self.lbl_green.setObjectName("lbl_green") 263 | self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.lbl_green) 264 | self.green = QtWidgets.QLineEdit(self.editfields) 265 | self.green.setAlignment(QtCore.Qt.AlignCenter) 266 | self.green.setObjectName("green") 267 | self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.green) 268 | self.lbl_blue = QtWidgets.QLabel(self.editfields) 269 | self.lbl_blue.setObjectName("lbl_blue") 270 | self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.lbl_blue) 271 | self.blue = QtWidgets.QLineEdit(self.editfields) 272 | self.blue.setAlignment(QtCore.Qt.AlignCenter) 273 | self.blue.setObjectName("blue") 274 | self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.blue) 275 | self.lbl_hex = QtWidgets.QLabel(self.editfields) 276 | self.lbl_hex.setStyleSheet("font-size: 14pt;") 277 | self.lbl_hex.setObjectName("lbl_hex") 278 | self.formLayout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.lbl_hex) 279 | self.hex = QtWidgets.QLineEdit(self.editfields) 280 | self.hex.setAlignment(QtCore.Qt.AlignCenter) 281 | self.hex.setObjectName("hex") 282 | self.formLayout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.hex) 283 | self.lbl_alpha = QtWidgets.QLabel(self.editfields) 284 | self.lbl_alpha.setObjectName("lbl_alpha") 285 | self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.lbl_alpha) 286 | self.alpha = QtWidgets.QLineEdit(self.editfields) 287 | self.alpha.setAlignment(QtCore.Qt.AlignCenter) 288 | self.alpha.setObjectName("alpha") 289 | self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.alpha) 290 | self.horizontalLayout.addWidget(self.editfields) 291 | self.verticalLayout_3.addWidget(self.content_bar) 292 | self.button_bar = QtWidgets.QFrame(self.drop_shadow_frame) 293 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) 294 | sizePolicy.setHorizontalStretch(0) 295 | sizePolicy.setVerticalStretch(0) 296 | sizePolicy.setHeightForWidth(self.button_bar.sizePolicy().hasHeightForWidth()) 297 | self.button_bar.setSizePolicy(sizePolicy) 298 | self.button_bar.setStyleSheet("QFrame{\n" 299 | "background-color: #1d1d1d;\n" 300 | "padding: 5px\n" 301 | "}\n" 302 | "") 303 | self.button_bar.setFrameShape(QtWidgets.QFrame.StyledPanel) 304 | self.button_bar.setFrameShadow(QtWidgets.QFrame.Raised) 305 | self.button_bar.setObjectName("button_bar") 306 | self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.button_bar) 307 | self.horizontalLayout_3.setContentsMargins(100, 0, 100, 0) 308 | self.horizontalLayout_3.setSpacing(10) 309 | self.horizontalLayout_3.setObjectName("horizontalLayout_3") 310 | self.buttonBox = QtWidgets.QDialogButtonBox(self.button_bar) 311 | self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) 312 | self.buttonBox.setCenterButtons(True) 313 | self.buttonBox.setObjectName("buttonBox") 314 | self.horizontalLayout_3.addWidget(self.buttonBox) 315 | self.verticalLayout_3.addWidget(self.button_bar) 316 | self.verticalLayout.addWidget(self.drop_shadow_frame) 317 | self.lbl_red.setBuddy(self.red) 318 | self.lbl_green.setBuddy(self.green) 319 | self.lbl_blue.setBuddy(self.blue) 320 | self.lbl_hex.setBuddy(self.blue) 321 | self.lbl_alpha.setBuddy(self.blue) 322 | 323 | self.retranslateUi(ColorPicker) 324 | QtCore.QMetaObject.connectSlotsByName(ColorPicker) 325 | ColorPicker.setTabOrder(self.red, self.green) 326 | ColorPicker.setTabOrder(self.green, self.blue) 327 | 328 | def retranslateUi(self, ColorPicker): 329 | _translate = QtCore.QCoreApplication.translate 330 | ColorPicker.setWindowTitle(_translate("ColorPicker", "Form")) 331 | self.window_title.setText(_translate("ColorPicker", "COLOR PICKER")) 332 | self.lbl_red.setText(_translate("ColorPicker", "R")) 333 | self.red.setText(_translate("ColorPicker", "255")) 334 | self.lbl_green.setText(_translate("ColorPicker", "G")) 335 | self.green.setText(_translate("ColorPicker", "255")) 336 | self.lbl_blue.setText(_translate("ColorPicker", "B")) 337 | self.blue.setText(_translate("ColorPicker", "255")) 338 | self.lbl_hex.setText(_translate("ColorPicker", "#")) 339 | self.hex.setText(_translate("ColorPicker", "ffffff")) 340 | self.lbl_alpha.setText(_translate("ColorPicker", "A")) 341 | self.alpha.setText(_translate("ColorPicker", "100")) 342 | -------------------------------------------------------------------------------- /vcolorpicker/ui_light.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'ui_light.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.0 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from qtpy import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_ColorPicker(object): 15 | def setupUi(self, ColorPicker): 16 | ColorPicker.setObjectName("ColorPicker") 17 | ColorPicker.resize(400, 300) 18 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) 19 | sizePolicy.setHorizontalStretch(0) 20 | sizePolicy.setVerticalStretch(0) 21 | sizePolicy.setHeightForWidth(ColorPicker.sizePolicy().hasHeightForWidth()) 22 | ColorPicker.setSizePolicy(sizePolicy) 23 | ColorPicker.setMinimumSize(QtCore.QSize(400, 300)) 24 | ColorPicker.setMaximumSize(QtCore.QSize(400, 300)) 25 | ColorPicker.setStyleSheet("QWidget{\n" 26 | " background-color: none;\n" 27 | "}\n" 28 | "\n" 29 | "/* LINE EDIT */\n" 30 | "QLineEdit{\n" 31 | " color: #000;\n" 32 | " background-color: #bbb;\n" 33 | " border: 2px solid #bbb;\n" 34 | " border-radius: 5px;\n" 35 | " selection-color: rgb(16, 16, 16);\n" 36 | " selection-background-color: rgb(221, 51, 34);\n" 37 | " font-family: Segoe UI;\n" 38 | " font-size: 11pt;\n" 39 | "}\n" 40 | "QLineEdit::focus{\n" 41 | " border-color: #444;\n" 42 | "}\n" 43 | "\n" 44 | "/* PUSH BUTTON */\n" 45 | "QPushButton{\n" 46 | " border: 2px solid #777;\n" 47 | " border-radius: 5px;\n" 48 | " font-family: Segoe UI;\n" 49 | " font-size: 9pt;\n" 50 | " font-weight: bold;\n" 51 | " color: #333;\n" 52 | " width: 100px;\n" 53 | "}\n" 54 | "QPushButton:hover{\n" 55 | " border: 2px solid #777;\n" 56 | " color: #111;\n" 57 | " background-color: #777;\n" 58 | "}\n" 59 | "QPushButton:pressed{\n" 60 | " border: 2px solid #aaa;\n" 61 | " color: #222;\n" 62 | " background-color: #aaa;\n" 63 | "}") 64 | self.verticalLayout = QtWidgets.QVBoxLayout(ColorPicker) 65 | self.verticalLayout.setContentsMargins(10, 10, 10, 10) 66 | self.verticalLayout.setSpacing(0) 67 | self.verticalLayout.setObjectName("verticalLayout") 68 | self.drop_shadow_frame = QtWidgets.QFrame(ColorPicker) 69 | self.drop_shadow_frame.setStyleSheet("QFrame{\n" 70 | "background-color: #eee;\n" 71 | "border-radius: 10px;\n" 72 | "}") 73 | self.drop_shadow_frame.setFrameShape(QtWidgets.QFrame.StyledPanel) 74 | self.drop_shadow_frame.setFrameShadow(QtWidgets.QFrame.Raised) 75 | self.drop_shadow_frame.setObjectName("drop_shadow_frame") 76 | self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.drop_shadow_frame) 77 | self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) 78 | self.verticalLayout_3.setSpacing(10) 79 | self.verticalLayout_3.setObjectName("verticalLayout_3") 80 | self.title_bar = QtWidgets.QFrame(self.drop_shadow_frame) 81 | self.title_bar.setMinimumSize(QtCore.QSize(0, 32)) 82 | self.title_bar.setStyleSheet("background-color: #bbb;") 83 | self.title_bar.setFrameShape(QtWidgets.QFrame.StyledPanel) 84 | self.title_bar.setFrameShadow(QtWidgets.QFrame.Raised) 85 | self.title_bar.setObjectName("title_bar") 86 | self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.title_bar) 87 | self.horizontalLayout_2.setContentsMargins(10, 0, 10, 0) 88 | self.horizontalLayout_2.setSpacing(5) 89 | self.horizontalLayout_2.setObjectName("horizontalLayout_2") 90 | spacerItem = QtWidgets.QSpacerItem(16, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) 91 | self.horizontalLayout_2.addItem(spacerItem) 92 | self.window_title = QtWidgets.QLabel(self.title_bar) 93 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) 94 | sizePolicy.setHorizontalStretch(0) 95 | sizePolicy.setVerticalStretch(0) 96 | sizePolicy.setHeightForWidth(self.window_title.sizePolicy().hasHeightForWidth()) 97 | self.window_title.setSizePolicy(sizePolicy) 98 | self.window_title.setMaximumSize(QtCore.QSize(16777215, 16777215)) 99 | self.window_title.setStyleSheet("QLabel{\n" 100 | " color: #444;\n" 101 | " font-family: Segoe UI;\n" 102 | " font-size: 9pt;\n" 103 | "}") 104 | self.window_title.setAlignment(QtCore.Qt.AlignCenter) 105 | self.window_title.setObjectName("window_title") 106 | self.horizontalLayout_2.addWidget(self.window_title) 107 | self.exit_btn = QtWidgets.QPushButton(self.title_bar) 108 | self.exit_btn.setMinimumSize(QtCore.QSize(16, 16)) 109 | self.exit_btn.setMaximumSize(QtCore.QSize(16, 16)) 110 | self.exit_btn.setFocusPolicy(QtCore.Qt.NoFocus) 111 | self.exit_btn.setStyleSheet("QPushButton{\n" 112 | " border: none;\n" 113 | " background-color: #888;\n" 114 | " border-radius: 8px\n" 115 | "}\n" 116 | "QPushButton:hover{\n" 117 | " background-color: #444;\n" 118 | "}") 119 | self.exit_btn.setText("") 120 | icon = QtGui.QIcon() 121 | icon.addPixmap(QtGui.QPixmap(":/img/exit.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) 122 | self.exit_btn.setIcon(icon) 123 | self.exit_btn.setIconSize(QtCore.QSize(12, 12)) 124 | self.exit_btn.setObjectName("exit_btn") 125 | self.horizontalLayout_2.addWidget(self.exit_btn) 126 | self.verticalLayout_3.addWidget(self.title_bar) 127 | self.content_bar = QtWidgets.QFrame(self.drop_shadow_frame) 128 | self.content_bar.setLayoutDirection(QtCore.Qt.LeftToRight) 129 | self.content_bar.setStyleSheet("border-radius: 4px") 130 | self.content_bar.setFrameShape(QtWidgets.QFrame.StyledPanel) 131 | self.content_bar.setFrameShadow(QtWidgets.QFrame.Raised) 132 | self.content_bar.setObjectName("content_bar") 133 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.content_bar) 134 | self.horizontalLayout.setContentsMargins(10, 0, 10, 0) 135 | self.horizontalLayout.setSpacing(10) 136 | self.horizontalLayout.setObjectName("horizontalLayout") 137 | self.color_view = QtWidgets.QFrame(self.content_bar) 138 | self.color_view.setMinimumSize(QtCore.QSize(200, 200)) 139 | self.color_view.setMaximumSize(QtCore.QSize(200, 200)) 140 | self.color_view.setStyleSheet("/* ALL CHANGES HERE WILL BE OVERWRITTEN */;\n" 141 | "background-color: qlineargradient(x1:1, x2:0, stop:0 hsl(0%,100%,50%), stop:1 rgba(255, 255, 255, 255));\n" 142 | "\n" 143 | "") 144 | self.color_view.setFrameShape(QtWidgets.QFrame.StyledPanel) 145 | self.color_view.setFrameShadow(QtWidgets.QFrame.Raised) 146 | self.color_view.setObjectName("color_view") 147 | self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.color_view) 148 | self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) 149 | self.verticalLayout_2.setSpacing(0) 150 | self.verticalLayout_2.setObjectName("verticalLayout_2") 151 | self.black_overlay = QtWidgets.QFrame(self.color_view) 152 | self.black_overlay.setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 0), stop:1 rgba(0, 0, 0, 255));\n" 153 | "border-radius: 4px;\n" 154 | "\n" 155 | "") 156 | self.black_overlay.setFrameShape(QtWidgets.QFrame.StyledPanel) 157 | self.black_overlay.setFrameShadow(QtWidgets.QFrame.Raised) 158 | self.black_overlay.setObjectName("black_overlay") 159 | self.selector = QtWidgets.QFrame(self.black_overlay) 160 | self.selector.setGeometry(QtCore.QRect(194, 20, 12, 12)) 161 | self.selector.setMinimumSize(QtCore.QSize(12, 12)) 162 | self.selector.setMaximumSize(QtCore.QSize(12, 12)) 163 | self.selector.setStyleSheet("background-color:none;\n" 164 | "border: 1px solid white;\n" 165 | "border-radius: 5px;") 166 | self.selector.setFrameShape(QtWidgets.QFrame.StyledPanel) 167 | self.selector.setFrameShadow(QtWidgets.QFrame.Raised) 168 | self.selector.setObjectName("selector") 169 | self.black_ring = QtWidgets.QLabel(self.selector) 170 | self.black_ring.setGeometry(QtCore.QRect(1, 1, 10, 10)) 171 | self.black_ring.setMinimumSize(QtCore.QSize(10, 10)) 172 | self.black_ring.setMaximumSize(QtCore.QSize(10, 10)) 173 | self.black_ring.setBaseSize(QtCore.QSize(10, 10)) 174 | self.black_ring.setStyleSheet("background-color: none;\n" 175 | "border: 1px solid black;\n" 176 | "border-radius: 5px;") 177 | self.black_ring.setText("") 178 | self.black_ring.setObjectName("black_ring") 179 | self.verticalLayout_2.addWidget(self.black_overlay) 180 | self.horizontalLayout.addWidget(self.color_view) 181 | self.frame_2 = QtWidgets.QFrame(self.content_bar) 182 | self.frame_2.setMinimumSize(QtCore.QSize(40, 0)) 183 | self.frame_2.setStyleSheet("") 184 | self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel) 185 | self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised) 186 | self.frame_2.setObjectName("frame_2") 187 | self.hue_bg = QtWidgets.QFrame(self.frame_2) 188 | self.hue_bg.setGeometry(QtCore.QRect(10, 0, 20, 200)) 189 | self.hue_bg.setMinimumSize(QtCore.QSize(20, 200)) 190 | self.hue_bg.setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(255, 0, 0, 255), stop:0.166 rgba(255, 255, 0, 255), stop:0.333 rgba(0, 255, 0, 255), stop:0.5 rgba(0, 255, 255, 255), stop:0.666 rgba(0, 0, 255, 255), stop:0.833 rgba(255, 0, 255, 255), stop:1 rgba(255, 0, 0, 255));\n" 191 | "border-radius: 5px;") 192 | self.hue_bg.setFrameShape(QtWidgets.QFrame.StyledPanel) 193 | self.hue_bg.setFrameShadow(QtWidgets.QFrame.Raised) 194 | self.hue_bg.setObjectName("hue_bg") 195 | self.hue_selector = QtWidgets.QLabel(self.frame_2) 196 | self.hue_selector.setGeometry(QtCore.QRect(7, 185, 26, 15)) 197 | self.hue_selector.setMinimumSize(QtCore.QSize(26, 0)) 198 | self.hue_selector.setStyleSheet("background-color: #222;\n" 199 | "border-radius: 5px;") 200 | self.hue_selector.setText("") 201 | self.hue_selector.setObjectName("hue_selector") 202 | self.hue = QtWidgets.QFrame(self.frame_2) 203 | self.hue.setGeometry(QtCore.QRect(7, 0, 26, 200)) 204 | self.hue.setMinimumSize(QtCore.QSize(20, 200)) 205 | self.hue.setStyleSheet("background-color: none;") 206 | self.hue.setFrameShape(QtWidgets.QFrame.StyledPanel) 207 | self.hue.setFrameShadow(QtWidgets.QFrame.Raised) 208 | self.hue.setObjectName("hue") 209 | self.horizontalLayout.addWidget(self.frame_2) 210 | self.editfields = QtWidgets.QFrame(self.content_bar) 211 | self.editfields.setMinimumSize(QtCore.QSize(110, 200)) 212 | self.editfields.setMaximumSize(QtCore.QSize(120, 200)) 213 | self.editfields.setStyleSheet("QLabel{\n" 214 | " font-family: Segoe UI;\n" 215 | " font-weight: bold;\n" 216 | " font-size: 11pt;\n" 217 | " color: #666;\n" 218 | " border-radius: 5px;\n" 219 | "}\n" 220 | "") 221 | self.editfields.setFrameShape(QtWidgets.QFrame.StyledPanel) 222 | self.editfields.setFrameShadow(QtWidgets.QFrame.Raised) 223 | self.editfields.setObjectName("editfields") 224 | self.formLayout = QtWidgets.QFormLayout(self.editfields) 225 | self.formLayout.setContentsMargins(15, 10, 15, 1) 226 | self.formLayout.setSpacing(5) 227 | self.formLayout.setObjectName("formLayout") 228 | self.color_vis = QtWidgets.QLabel(self.editfields) 229 | self.color_vis.setMinimumSize(QtCore.QSize(0, 30)) 230 | self.color_vis.setStyleSheet("/* ALL CHANGES HERE WILL BE OVERWRITTEN */;\n" 231 | "background-color: rgb(255, 255, 255);\n" 232 | "") 233 | self.color_vis.setText("") 234 | self.color_vis.setObjectName("color_vis") 235 | self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.color_vis) 236 | self.lastcolor_vis = QtWidgets.QLabel(self.editfields) 237 | self.lastcolor_vis.setMinimumSize(QtCore.QSize(0, 30)) 238 | self.lastcolor_vis.setStyleSheet("/* ALL CHANGES HERE WILL BE OVERWRITTEN */;\n" 239 | "background-color: rgb(0, 0, 0);") 240 | self.lastcolor_vis.setText("") 241 | self.lastcolor_vis.setObjectName("lastcolor_vis") 242 | self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.lastcolor_vis) 243 | self.lbl_red = QtWidgets.QLabel(self.editfields) 244 | self.lbl_red.setObjectName("lbl_red") 245 | self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.lbl_red) 246 | self.red = QtWidgets.QLineEdit(self.editfields) 247 | self.red.setAlignment(QtCore.Qt.AlignCenter) 248 | self.red.setClearButtonEnabled(False) 249 | self.red.setObjectName("red") 250 | self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.red) 251 | self.lbl_green = QtWidgets.QLabel(self.editfields) 252 | self.lbl_green.setObjectName("lbl_green") 253 | self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.lbl_green) 254 | self.green = QtWidgets.QLineEdit(self.editfields) 255 | self.green.setAlignment(QtCore.Qt.AlignCenter) 256 | self.green.setObjectName("green") 257 | self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.green) 258 | self.lbl_blue = QtWidgets.QLabel(self.editfields) 259 | self.lbl_blue.setObjectName("lbl_blue") 260 | self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.lbl_blue) 261 | self.blue = QtWidgets.QLineEdit(self.editfields) 262 | self.blue.setAlignment(QtCore.Qt.AlignCenter) 263 | self.blue.setObjectName("blue") 264 | self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.blue) 265 | self.hex = QtWidgets.QLineEdit(self.editfields) 266 | self.hex.setAlignment(QtCore.Qt.AlignCenter) 267 | self.hex.setObjectName("hex") 268 | self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.hex) 269 | self.lbl_hex = QtWidgets.QLabel(self.editfields) 270 | self.lbl_hex.setStyleSheet("font-size: 14pt;") 271 | self.lbl_hex.setObjectName("lbl_hex") 272 | self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.lbl_hex) 273 | self.horizontalLayout.addWidget(self.editfields) 274 | self.verticalLayout_3.addWidget(self.content_bar) 275 | self.button_bar = QtWidgets.QFrame(self.drop_shadow_frame) 276 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) 277 | sizePolicy.setHorizontalStretch(0) 278 | sizePolicy.setVerticalStretch(0) 279 | sizePolicy.setHeightForWidth(self.button_bar.sizePolicy().hasHeightForWidth()) 280 | self.button_bar.setSizePolicy(sizePolicy) 281 | self.button_bar.setStyleSheet("QFrame{\n" 282 | "background-color: #ccc;\n" 283 | "padding: 5px\n" 284 | "}\n" 285 | "") 286 | self.button_bar.setFrameShape(QtWidgets.QFrame.StyledPanel) 287 | self.button_bar.setFrameShadow(QtWidgets.QFrame.Raised) 288 | self.button_bar.setObjectName("button_bar") 289 | self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.button_bar) 290 | self.horizontalLayout_3.setContentsMargins(100, 0, 100, 0) 291 | self.horizontalLayout_3.setSpacing(10) 292 | self.horizontalLayout_3.setObjectName("horizontalLayout_3") 293 | self.buttonBox = QtWidgets.QDialogButtonBox(self.button_bar) 294 | self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) 295 | self.buttonBox.setCenterButtons(True) 296 | self.buttonBox.setObjectName("buttonBox") 297 | self.horizontalLayout_3.addWidget(self.buttonBox) 298 | self.verticalLayout_3.addWidget(self.button_bar) 299 | self.verticalLayout.addWidget(self.drop_shadow_frame) 300 | self.lbl_red.setBuddy(self.red) 301 | self.lbl_green.setBuddy(self.green) 302 | self.lbl_blue.setBuddy(self.blue) 303 | self.lbl_hex.setBuddy(self.blue) 304 | 305 | self.retranslateUi(ColorPicker) 306 | QtCore.QMetaObject.connectSlotsByName(ColorPicker) 307 | ColorPicker.setTabOrder(self.red, self.green) 308 | ColorPicker.setTabOrder(self.green, self.blue) 309 | 310 | def retranslateUi(self, ColorPicker): 311 | _translate = QtCore.QCoreApplication.translate 312 | ColorPicker.setWindowTitle(_translate("ColorPicker", "Form")) 313 | self.window_title.setText(_translate("ColorPicker", "COLOR PICKER")) 314 | self.lbl_red.setText(_translate("ColorPicker", "R")) 315 | self.red.setText(_translate("ColorPicker", "255")) 316 | self.lbl_green.setText(_translate("ColorPicker", "G")) 317 | self.green.setText(_translate("ColorPicker", "255")) 318 | self.lbl_blue.setText(_translate("ColorPicker", "B")) 319 | self.blue.setText(_translate("ColorPicker", "255")) 320 | self.hex.setText(_translate("ColorPicker", "ffffff")) 321 | self.lbl_hex.setText(_translate("ColorPicker", "#")) 322 | -------------------------------------------------------------------------------- /vcolorpicker/ui_light_alpha.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'ui_light_alpha.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.0 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from qtpy import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_ColorPicker(object): 15 | def setupUi(self, ColorPicker): 16 | ColorPicker.setObjectName("ColorPicker") 17 | ColorPicker.resize(400, 300) 18 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) 19 | sizePolicy.setHorizontalStretch(0) 20 | sizePolicy.setVerticalStretch(0) 21 | sizePolicy.setHeightForWidth(ColorPicker.sizePolicy().hasHeightForWidth()) 22 | ColorPicker.setSizePolicy(sizePolicy) 23 | ColorPicker.setMinimumSize(QtCore.QSize(400, 300)) 24 | ColorPicker.setMaximumSize(QtCore.QSize(400, 300)) 25 | ColorPicker.setStyleSheet("QWidget{\n" 26 | " background-color: none;\n" 27 | "}\n" 28 | "\n" 29 | "/* LINE EDIT */\n" 30 | "QLineEdit{\n" 31 | " color: #000;\n" 32 | " background-color: #bbb;\n" 33 | " border: 2px solid #bbb;\n" 34 | " border-radius: 5px;\n" 35 | " selection-color: rgb(16, 16, 16);\n" 36 | " selection-background-color: rgb(221, 51, 34);\n" 37 | " font-family: Segoe UI;\n" 38 | " font-size: 11pt;\n" 39 | "}\n" 40 | "QLineEdit::focus{\n" 41 | " border-color: #444;\n" 42 | "}\n" 43 | "\n" 44 | "/* PUSH BUTTON */\n" 45 | "QPushButton{\n" 46 | " border: 2px solid #777;\n" 47 | " border-radius: 5px;\n" 48 | " font-family: Segoe UI;\n" 49 | " font-size: 9pt;\n" 50 | " font-weight: bold;\n" 51 | " color: #333;\n" 52 | " width: 100px;\n" 53 | "}\n" 54 | "QPushButton:hover{\n" 55 | " border: 2px solid #777;\n" 56 | " color: #111;\n" 57 | " background-color: #777;\n" 58 | "}\n" 59 | "QPushButton:pressed{\n" 60 | " border: 2px solid #aaa;\n" 61 | " color: #222;\n" 62 | " background-color: #aaa;\n" 63 | "}") 64 | self.verticalLayout = QtWidgets.QVBoxLayout(ColorPicker) 65 | self.verticalLayout.setContentsMargins(10, 10, 10, 10) 66 | self.verticalLayout.setSpacing(0) 67 | self.verticalLayout.setObjectName("verticalLayout") 68 | self.drop_shadow_frame = QtWidgets.QFrame(ColorPicker) 69 | self.drop_shadow_frame.setStyleSheet("QFrame{\n" 70 | "background-color: #eee;\n" 71 | "border-radius: 10px;\n" 72 | "}") 73 | self.drop_shadow_frame.setFrameShape(QtWidgets.QFrame.StyledPanel) 74 | self.drop_shadow_frame.setFrameShadow(QtWidgets.QFrame.Raised) 75 | self.drop_shadow_frame.setObjectName("drop_shadow_frame") 76 | self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.drop_shadow_frame) 77 | self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) 78 | self.verticalLayout_3.setSpacing(10) 79 | self.verticalLayout_3.setObjectName("verticalLayout_3") 80 | self.title_bar = QtWidgets.QFrame(self.drop_shadow_frame) 81 | self.title_bar.setMinimumSize(QtCore.QSize(0, 32)) 82 | self.title_bar.setStyleSheet("background-color: #bbb;") 83 | self.title_bar.setFrameShape(QtWidgets.QFrame.StyledPanel) 84 | self.title_bar.setFrameShadow(QtWidgets.QFrame.Raised) 85 | self.title_bar.setObjectName("title_bar") 86 | self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.title_bar) 87 | self.horizontalLayout_2.setContentsMargins(10, 0, 10, 0) 88 | self.horizontalLayout_2.setSpacing(5) 89 | self.horizontalLayout_2.setObjectName("horizontalLayout_2") 90 | spacerItem = QtWidgets.QSpacerItem(16, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) 91 | self.horizontalLayout_2.addItem(spacerItem) 92 | self.window_title = QtWidgets.QLabel(self.title_bar) 93 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) 94 | sizePolicy.setHorizontalStretch(0) 95 | sizePolicy.setVerticalStretch(0) 96 | sizePolicy.setHeightForWidth(self.window_title.sizePolicy().hasHeightForWidth()) 97 | self.window_title.setSizePolicy(sizePolicy) 98 | self.window_title.setMaximumSize(QtCore.QSize(16777215, 16777215)) 99 | self.window_title.setStyleSheet("QLabel{\n" 100 | " color: #444;\n" 101 | " font-family: Segoe UI;\n" 102 | " font-size: 9pt;\n" 103 | "}") 104 | self.window_title.setAlignment(QtCore.Qt.AlignCenter) 105 | self.window_title.setObjectName("window_title") 106 | self.horizontalLayout_2.addWidget(self.window_title) 107 | self.exit_btn = QtWidgets.QPushButton(self.title_bar) 108 | self.exit_btn.setMinimumSize(QtCore.QSize(16, 16)) 109 | self.exit_btn.setMaximumSize(QtCore.QSize(16, 16)) 110 | self.exit_btn.setFocusPolicy(QtCore.Qt.NoFocus) 111 | self.exit_btn.setStyleSheet("QPushButton{\n" 112 | " border: none;\n" 113 | " background-color: #888;\n" 114 | " border-radius: 8px\n" 115 | "}\n" 116 | "QPushButton:hover{\n" 117 | " background-color: #444;\n" 118 | "}") 119 | self.exit_btn.setText("") 120 | icon = QtGui.QIcon() 121 | icon.addPixmap(QtGui.QPixmap(":/img/exit.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) 122 | self.exit_btn.setIcon(icon) 123 | self.exit_btn.setIconSize(QtCore.QSize(12, 12)) 124 | self.exit_btn.setObjectName("exit_btn") 125 | self.horizontalLayout_2.addWidget(self.exit_btn) 126 | self.verticalLayout_3.addWidget(self.title_bar) 127 | self.content_bar = QtWidgets.QFrame(self.drop_shadow_frame) 128 | self.content_bar.setLayoutDirection(QtCore.Qt.LeftToRight) 129 | self.content_bar.setStyleSheet("border-radius: 4px") 130 | self.content_bar.setFrameShape(QtWidgets.QFrame.StyledPanel) 131 | self.content_bar.setFrameShadow(QtWidgets.QFrame.Raised) 132 | self.content_bar.setObjectName("content_bar") 133 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.content_bar) 134 | self.horizontalLayout.setContentsMargins(10, 0, 10, 0) 135 | self.horizontalLayout.setSpacing(10) 136 | self.horizontalLayout.setObjectName("horizontalLayout") 137 | self.color_view = QtWidgets.QFrame(self.content_bar) 138 | self.color_view.setMinimumSize(QtCore.QSize(200, 200)) 139 | self.color_view.setMaximumSize(QtCore.QSize(200, 200)) 140 | self.color_view.setStyleSheet("/* ALL CHANGES HERE WILL BE OVERWRITTEN */;\n" 141 | "background-color: qlineargradient(x1:1, x2:0, stop:0 hsl(0%,100%,50%), stop:1 rgba(255, 255, 255, 255));\n" 142 | "\n" 143 | "") 144 | self.color_view.setFrameShape(QtWidgets.QFrame.StyledPanel) 145 | self.color_view.setFrameShadow(QtWidgets.QFrame.Raised) 146 | self.color_view.setObjectName("color_view") 147 | self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.color_view) 148 | self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) 149 | self.verticalLayout_2.setSpacing(0) 150 | self.verticalLayout_2.setObjectName("verticalLayout_2") 151 | self.black_overlay = QtWidgets.QFrame(self.color_view) 152 | self.black_overlay.setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 0), stop:1 rgba(0, 0, 0, 255));\n" 153 | "border-radius: 4px;\n" 154 | "\n" 155 | "") 156 | self.black_overlay.setFrameShape(QtWidgets.QFrame.StyledPanel) 157 | self.black_overlay.setFrameShadow(QtWidgets.QFrame.Raised) 158 | self.black_overlay.setObjectName("black_overlay") 159 | self.selector = QtWidgets.QFrame(self.black_overlay) 160 | self.selector.setGeometry(QtCore.QRect(194, 20, 12, 12)) 161 | self.selector.setMinimumSize(QtCore.QSize(12, 12)) 162 | self.selector.setMaximumSize(QtCore.QSize(12, 12)) 163 | self.selector.setStyleSheet("background-color:none;\n" 164 | "border: 1px solid white;\n" 165 | "border-radius: 5px;") 166 | self.selector.setFrameShape(QtWidgets.QFrame.StyledPanel) 167 | self.selector.setFrameShadow(QtWidgets.QFrame.Raised) 168 | self.selector.setObjectName("selector") 169 | self.black_ring = QtWidgets.QLabel(self.selector) 170 | self.black_ring.setGeometry(QtCore.QRect(1, 1, 10, 10)) 171 | self.black_ring.setMinimumSize(QtCore.QSize(10, 10)) 172 | self.black_ring.setMaximumSize(QtCore.QSize(10, 10)) 173 | self.black_ring.setBaseSize(QtCore.QSize(10, 10)) 174 | self.black_ring.setStyleSheet("background-color: none;\n" 175 | "border: 1px solid black;\n" 176 | "border-radius: 5px;") 177 | self.black_ring.setText("") 178 | self.black_ring.setObjectName("black_ring") 179 | self.verticalLayout_2.addWidget(self.black_overlay) 180 | self.horizontalLayout.addWidget(self.color_view) 181 | self.frame_2 = QtWidgets.QFrame(self.content_bar) 182 | self.frame_2.setMinimumSize(QtCore.QSize(40, 0)) 183 | self.frame_2.setStyleSheet("") 184 | self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel) 185 | self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised) 186 | self.frame_2.setObjectName("frame_2") 187 | self.hue_bg = QtWidgets.QFrame(self.frame_2) 188 | self.hue_bg.setGeometry(QtCore.QRect(10, 0, 20, 200)) 189 | self.hue_bg.setMinimumSize(QtCore.QSize(20, 200)) 190 | self.hue_bg.setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(255, 0, 0, 255), stop:0.166 rgba(255, 255, 0, 255), stop:0.333 rgba(0, 255, 0, 255), stop:0.5 rgba(0, 255, 255, 255), stop:0.666 rgba(0, 0, 255, 255), stop:0.833 rgba(255, 0, 255, 255), stop:1 rgba(255, 0, 0, 255));\n" 191 | "border-radius: 5px;") 192 | self.hue_bg.setFrameShape(QtWidgets.QFrame.StyledPanel) 193 | self.hue_bg.setFrameShadow(QtWidgets.QFrame.Raised) 194 | self.hue_bg.setObjectName("hue_bg") 195 | self.hue_selector = QtWidgets.QLabel(self.frame_2) 196 | self.hue_selector.setGeometry(QtCore.QRect(7, 185, 26, 15)) 197 | self.hue_selector.setMinimumSize(QtCore.QSize(26, 0)) 198 | self.hue_selector.setStyleSheet("background-color: #222;\n" 199 | "border-radius: 5px;") 200 | self.hue_selector.setText("") 201 | self.hue_selector.setObjectName("hue_selector") 202 | self.hue = QtWidgets.QFrame(self.frame_2) 203 | self.hue.setGeometry(QtCore.QRect(7, 0, 26, 200)) 204 | self.hue.setMinimumSize(QtCore.QSize(20, 200)) 205 | self.hue.setStyleSheet("background-color: none;") 206 | self.hue.setFrameShape(QtWidgets.QFrame.StyledPanel) 207 | self.hue.setFrameShadow(QtWidgets.QFrame.Raised) 208 | self.hue.setObjectName("hue") 209 | self.horizontalLayout.addWidget(self.frame_2) 210 | self.editfields = QtWidgets.QFrame(self.content_bar) 211 | self.editfields.setMinimumSize(QtCore.QSize(110, 200)) 212 | self.editfields.setMaximumSize(QtCore.QSize(120, 200)) 213 | self.editfields.setStyleSheet("QLabel{\n" 214 | " font-family: Segoe UI;\n" 215 | " font-weight: bold;\n" 216 | " font-size: 11pt;\n" 217 | " color: #666;\n" 218 | " border-radius: 5px;\n" 219 | "}\n" 220 | "") 221 | self.editfields.setFrameShape(QtWidgets.QFrame.StyledPanel) 222 | self.editfields.setFrameShadow(QtWidgets.QFrame.Raised) 223 | self.editfields.setObjectName("editfields") 224 | self.formLayout = QtWidgets.QFormLayout(self.editfields) 225 | self.formLayout.setContentsMargins(15, 10, 15, 1) 226 | self.formLayout.setSpacing(5) 227 | self.formLayout.setObjectName("formLayout") 228 | self.color_vis = QtWidgets.QLabel(self.editfields) 229 | self.color_vis.setMinimumSize(QtCore.QSize(0, 24)) 230 | self.color_vis.setStyleSheet("/* ALL CHANGES HERE WILL BE OVERWRITTEN */;\n" 231 | "background-color: rgb(255, 255, 255);\n" 232 | "") 233 | self.color_vis.setText("") 234 | self.color_vis.setObjectName("color_vis") 235 | self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.color_vis) 236 | self.lastcolor_vis = QtWidgets.QLabel(self.editfields) 237 | self.lastcolor_vis.setMinimumSize(QtCore.QSize(0, 24)) 238 | self.lastcolor_vis.setStyleSheet("/* ALL CHANGES HERE WILL BE OVERWRITTEN */;\n" 239 | "background-color: rgb(0, 0, 0);") 240 | self.lastcolor_vis.setText("") 241 | self.lastcolor_vis.setObjectName("lastcolor_vis") 242 | self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.lastcolor_vis) 243 | self.lbl_red = QtWidgets.QLabel(self.editfields) 244 | self.lbl_red.setObjectName("lbl_red") 245 | self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.lbl_red) 246 | self.red = QtWidgets.QLineEdit(self.editfields) 247 | self.red.setAlignment(QtCore.Qt.AlignCenter) 248 | self.red.setClearButtonEnabled(False) 249 | self.red.setObjectName("red") 250 | self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.red) 251 | self.lbl_green = QtWidgets.QLabel(self.editfields) 252 | self.lbl_green.setObjectName("lbl_green") 253 | self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.lbl_green) 254 | self.green = QtWidgets.QLineEdit(self.editfields) 255 | self.green.setAlignment(QtCore.Qt.AlignCenter) 256 | self.green.setObjectName("green") 257 | self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.green) 258 | self.lbl_blue = QtWidgets.QLabel(self.editfields) 259 | self.lbl_blue.setObjectName("lbl_blue") 260 | self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.lbl_blue) 261 | self.blue = QtWidgets.QLineEdit(self.editfields) 262 | self.blue.setAlignment(QtCore.Qt.AlignCenter) 263 | self.blue.setObjectName("blue") 264 | self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.blue) 265 | self.hex = QtWidgets.QLineEdit(self.editfields) 266 | self.hex.setAlignment(QtCore.Qt.AlignCenter) 267 | self.hex.setObjectName("hex") 268 | self.formLayout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.hex) 269 | self.lbl_hex = QtWidgets.QLabel(self.editfields) 270 | self.lbl_hex.setStyleSheet("font-size: 14pt;") 271 | self.lbl_hex.setObjectName("lbl_hex") 272 | self.formLayout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.lbl_hex) 273 | self.alpha = QtWidgets.QLineEdit(self.editfields) 274 | self.alpha.setAlignment(QtCore.Qt.AlignCenter) 275 | self.alpha.setObjectName("alpha") 276 | self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.alpha) 277 | self.lbl_alpha = QtWidgets.QLabel(self.editfields) 278 | self.lbl_alpha.setObjectName("lbl_alpha") 279 | self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.lbl_alpha) 280 | self.horizontalLayout.addWidget(self.editfields) 281 | self.verticalLayout_3.addWidget(self.content_bar) 282 | self.button_bar = QtWidgets.QFrame(self.drop_shadow_frame) 283 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) 284 | sizePolicy.setHorizontalStretch(0) 285 | sizePolicy.setVerticalStretch(0) 286 | sizePolicy.setHeightForWidth(self.button_bar.sizePolicy().hasHeightForWidth()) 287 | self.button_bar.setSizePolicy(sizePolicy) 288 | self.button_bar.setStyleSheet("QFrame{\n" 289 | "background-color: #ccc;\n" 290 | "padding: 5px\n" 291 | "}\n" 292 | "") 293 | self.button_bar.setFrameShape(QtWidgets.QFrame.StyledPanel) 294 | self.button_bar.setFrameShadow(QtWidgets.QFrame.Raised) 295 | self.button_bar.setObjectName("button_bar") 296 | self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.button_bar) 297 | self.horizontalLayout_3.setContentsMargins(100, 0, 100, 0) 298 | self.horizontalLayout_3.setSpacing(10) 299 | self.horizontalLayout_3.setObjectName("horizontalLayout_3") 300 | self.buttonBox = QtWidgets.QDialogButtonBox(self.button_bar) 301 | self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) 302 | self.buttonBox.setCenterButtons(True) 303 | self.buttonBox.setObjectName("buttonBox") 304 | self.horizontalLayout_3.addWidget(self.buttonBox) 305 | self.verticalLayout_3.addWidget(self.button_bar) 306 | self.verticalLayout.addWidget(self.drop_shadow_frame) 307 | self.lbl_red.setBuddy(self.red) 308 | self.lbl_green.setBuddy(self.green) 309 | self.lbl_blue.setBuddy(self.blue) 310 | self.lbl_hex.setBuddy(self.blue) 311 | self.lbl_alpha.setBuddy(self.blue) 312 | 313 | self.retranslateUi(ColorPicker) 314 | QtCore.QMetaObject.connectSlotsByName(ColorPicker) 315 | ColorPicker.setTabOrder(self.red, self.green) 316 | ColorPicker.setTabOrder(self.green, self.blue) 317 | 318 | def retranslateUi(self, ColorPicker): 319 | _translate = QtCore.QCoreApplication.translate 320 | ColorPicker.setWindowTitle(_translate("ColorPicker", "Form")) 321 | self.window_title.setText(_translate("ColorPicker", "COLOR PICKER")) 322 | self.lbl_red.setText(_translate("ColorPicker", "R")) 323 | self.red.setText(_translate("ColorPicker", "255")) 324 | self.lbl_green.setText(_translate("ColorPicker", "G")) 325 | self.green.setText(_translate("ColorPicker", "255")) 326 | self.lbl_blue.setText(_translate("ColorPicker", "B")) 327 | self.blue.setText(_translate("ColorPicker", "255")) 328 | self.hex.setText(_translate("ColorPicker", "ffffff")) 329 | self.lbl_hex.setText(_translate("ColorPicker", "#")) 330 | self.alpha.setText(_translate("ColorPicker", "255")) 331 | self.lbl_alpha.setText(_translate("ColorPicker", "A")) 332 | -------------------------------------------------------------------------------- /vcolorpicker/vcolorpicker.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------- # 2 | # # 3 | # Modern Color Picker by Tom F. # 4 | # made with Qt Creator & PyQt # 5 | # # 6 | # ------------------------------------- # 7 | 8 | import colorsys 9 | from typing import Union 10 | 11 | from qtpy.QtCore import (QPoint, Qt) 12 | from qtpy.QtGui import QColor 13 | from qtpy.QtWidgets import (QApplication, QDialog, QGraphicsDropShadowEffect) 14 | 15 | from .ui_dark import Ui_ColorPicker as Ui_Dark 16 | from .ui_dark_alpha import Ui_ColorPicker as Ui_Dark_Alpha 17 | from .ui_light import Ui_ColorPicker as Ui_Light 18 | from .ui_light_alpha import Ui_ColorPicker as Ui_Light_Alpha 19 | 20 | from .img import * 21 | 22 | 23 | class ColorPicker(QDialog): 24 | 25 | def __init__(self, lightTheme: bool = False, useAlpha: bool = False): 26 | """Create a new ColorPicker instance. 27 | 28 | :param lightTheme: If the UI should be light themed. 29 | :param useAlpha: If the ColorPicker should work with alpha values. 30 | """ 31 | 32 | # auto-create QApplication if it doesn't exist yet 33 | self.app = QApplication.instance() 34 | if self.app is None: self.app = QApplication([]) 35 | 36 | super(ColorPicker, self).__init__() 37 | 38 | self.usingAlpha = useAlpha 39 | self.usingLightTheme = lightTheme 40 | 41 | # Call UI Builder function 42 | if useAlpha: 43 | if lightTheme: self.ui = Ui_Light_Alpha() 44 | else: self.ui = Ui_Dark_Alpha() 45 | self.ui.setupUi(self) 46 | else: 47 | if lightTheme: self.ui = Ui_Light() 48 | else: self.ui = Ui_Dark() 49 | self.ui.setupUi(self) 50 | 51 | 52 | # Make Frameless 53 | self.setWindowFlags(Qt.FramelessWindowHint) 54 | self.setAttribute(Qt.WA_TranslucentBackground) 55 | self.setWindowTitle("Color Picker") 56 | 57 | # Add DropShadow 58 | self.shadow = QGraphicsDropShadowEffect(self) 59 | self.shadow.setBlurRadius(17) 60 | self.shadow.setXOffset(0) 61 | self.shadow.setYOffset(0) 62 | self.shadow.setColor(QColor(0, 0, 0, 150)) 63 | self.ui.drop_shadow_frame.setGraphicsEffect(self.shadow) 64 | 65 | # Connect update functions 66 | self.ui.hue.mousePressEvent = self.moveHueSelector 67 | self.ui.hue.mouseMoveEvent = self.moveHueSelector 68 | self.ui.red.textEdited.connect(self.rgbChanged) 69 | self.ui.green.textEdited.connect(self.rgbChanged) 70 | self.ui.blue.textEdited.connect(self.rgbChanged) 71 | self.ui.hex.textEdited.connect(self.hexChanged) 72 | if self.usingAlpha: self.ui.alpha.textEdited.connect(self.alphaChanged) 73 | 74 | # Connect window dragging functions 75 | self.ui.title_bar.mouseMoveEvent = self.moveWindow 76 | self.ui.title_bar.mousePressEvent = self.setDragPos 77 | self.ui.window_title.mouseMoveEvent = self.moveWindow 78 | self.ui.window_title.mousePressEvent = self.setDragPos 79 | 80 | # Connect selector moving function 81 | self.ui.black_overlay.mouseMoveEvent = self.moveSVSelector 82 | self.ui.black_overlay.mousePressEvent = self.moveSVSelector 83 | 84 | # Connect Ok|Cancel Button Box and X Button 85 | self.ui.buttonBox.accepted.connect(self.accept) 86 | self.ui.buttonBox.rejected.connect(self.reject) 87 | self.ui.exit_btn.clicked.connect(self.reject) 88 | 89 | self.lastcolor = (0, 0, 0) 90 | self.color = (0, 0, 0) 91 | self.alpha = 100 92 | 93 | def getColor(self, lc: tuple = None): 94 | """Open the UI and get a color from the user. 95 | 96 | :param lc: The color to show as previous color. 97 | :return: The selected color. 98 | """ 99 | 100 | if lc != None and self.usingAlpha: 101 | alpha = lc[3] 102 | lc = lc[:3] 103 | self.setAlpha(alpha) 104 | self.alpha = alpha 105 | if lc == None: lc = self.lastcolor 106 | else: self.lastcolor = lc 107 | 108 | self.setRGB(lc) 109 | self.rgbChanged() 110 | r,g,b = lc 111 | self.ui.lastcolor_vis.setStyleSheet(f"background-color: rgb({r},{g},{b})") 112 | 113 | if self.exec_(): 114 | r, g, b = hsv2rgb(self.color) 115 | self.lastcolor = (r,g,b) 116 | if self.usingAlpha: return (r,g,b,self.alpha) 117 | return (r,g,b) 118 | 119 | else: 120 | return self.lastcolor 121 | 122 | # Update Functions 123 | def hsvChanged(self): 124 | h,s,v = (100 - self.ui.hue_selector.y() / 1.85, (self.ui.selector.x() + 6) / 2.0, (194 - self.ui.selector.y()) / 2.0) 125 | r,g,b = hsv2rgb(h,s,v) 126 | self.color = (h,s,v) 127 | self.setRGB((r,g,b)) 128 | self.setHex(hsv2hex(self.color)) 129 | self.ui.color_vis.setStyleSheet(f"background-color: rgb({r},{g},{b})") 130 | self.ui.color_view.setStyleSheet(f"border-radius: 5px;background-color: qlineargradient(x1:1, x2:0, stop:0 hsl({h}%,100%,50%), stop:1 #fff);") 131 | 132 | def rgbChanged(self): 133 | r,g,b = self.i(self.ui.red.text()), self.i(self.ui.green.text()), self.i(self.ui.blue.text()) 134 | cr,cg,cb = self.clampRGB((r,g,b)) 135 | 136 | if r!=cr or (r==0 and self.ui.red.hasFocus()): 137 | self.setRGB((cr,cg,cb)) 138 | self.ui.red.selectAll() 139 | if g!=cg or (g==0 and self.ui.green.hasFocus()): 140 | self.setRGB((cr,cg,cb)) 141 | self.ui.green.selectAll() 142 | if b!=cb or (b==0 and self.ui.blue.hasFocus()): 143 | self.setRGB((cr,cg,cb)) 144 | self.ui.blue.selectAll() 145 | 146 | self.color = rgb2hsv(r,g,b) 147 | self.setHSV(self.color) 148 | self.setHex(rgb2hex((r,g,b))) 149 | self.ui.color_vis.setStyleSheet(f"background-color: rgb({r},{g},{b})") 150 | 151 | def hexChanged(self): 152 | hex = self.ui.hex.text() 153 | try: 154 | int(hex, 16) 155 | except ValueError: 156 | hex = "000000" 157 | self.ui.hex.setText("") 158 | r, g, b = hex2rgb(hex) 159 | self.color = hex2hsv(hex) 160 | self.setHSV(self.color) 161 | self.setRGB((r, g, b)) 162 | self.ui.color_vis.setStyleSheet(f"background-color: rgb({r},{g},{b})") 163 | 164 | def alphaChanged(self): 165 | alpha = self.i(self.ui.alpha.text()) 166 | oldalpha = alpha 167 | if alpha < 0: alpha = 0 168 | if alpha > 100: alpha = 100 169 | if alpha != oldalpha or alpha == 0: 170 | self.ui.alpha.setText(str(alpha)) 171 | self.ui.alpha.selectAll() 172 | self.alpha = alpha 173 | 174 | # Internal setting functions 175 | def setRGB(self, c): 176 | r,g,b = c 177 | self.ui.red.setText(str(self.i(r))) 178 | self.ui.green.setText(str(self.i(g))) 179 | self.ui.blue.setText(str(self.i(b))) 180 | 181 | def setHSV(self, c): 182 | self.ui.hue_selector.move(7, int((100 - c[0]) * 1.85)) 183 | self.ui.color_view.setStyleSheet(f"border-radius: 5px;background-color: qlineargradient(x1:1, x2:0, stop:0 hsl({c[0]}%,100%,50%), stop:1 #fff);") 184 | self.ui.selector.move(int(c[1] * 2 - 6), int((200 - c[2] * 2) - 6)) 185 | 186 | def setHex(self, c): 187 | self.ui.hex.setText(c) 188 | 189 | def setAlpha(self, a): 190 | self.ui.alpha.setText(str(a)) 191 | 192 | # Dragging Functions 193 | def setDragPos(self, event): 194 | self.dragPos = event.globalPos() 195 | 196 | def moveWindow(self, event): 197 | # MOVE WINDOW 198 | if event.buttons() == Qt.LeftButton: 199 | self.move(self.pos() + event.globalPos() - self.dragPos) 200 | self.dragPos = event.globalPos() 201 | event.accept() 202 | 203 | def moveSVSelector(self, event): 204 | if event.buttons() == Qt.LeftButton: 205 | pos = event.pos() 206 | if pos.x() < 0: pos.setX(0) 207 | if pos.y() < 0: pos.setY(0) 208 | if pos.x() > 200: pos.setX(200) 209 | if pos.y() > 200: pos.setY(200) 210 | self.ui.selector.move(pos - QPoint(6,6)) 211 | self.hsvChanged() 212 | 213 | def moveHueSelector(self, event): 214 | if event.buttons() == Qt.LeftButton: 215 | pos = event.pos().y() - 7 216 | if pos < 0: pos = 0 217 | if pos > 185: pos = 185 218 | self.ui.hue_selector.move(QPoint(7, pos)) 219 | self.hsvChanged() 220 | 221 | # Utility 222 | 223 | # Custom int() function, that converts invalid strings to 0 224 | def i(self, text): 225 | try: return int(text) 226 | except ValueError: return 0 227 | 228 | # clamp function to remove near-zero values 229 | def clampRGB(self, rgb): 230 | r, g, b = rgb 231 | if r<0.0001: r=0 232 | if g<0.0001: g=0 233 | if b<0.0001: b=0 234 | if r>255: r=255 235 | if g>255: g=255 236 | if b>255: b=255 237 | return r, g, b 238 | 239 | 240 | # Color Utility 241 | def hsv2rgb(h_or_color: Union[tuple, int], s: int = 0, v: int = 0, a: int = None) -> tuple: 242 | """Convert hsv color to rgb color. 243 | 244 | :param h_or_color: The 'hue' value or a color tuple. 245 | :param s: The 'saturation' value. 246 | :param v: The 'value' value. 247 | :param a: The 'alpha' value. 248 | :return: The converted rgb tuple color. 249 | """ 250 | 251 | if type(h_or_color).__name__ == "tuple": 252 | if len(h_or_color) == 4: 253 | h, s, v, a = h_or_color 254 | else: 255 | h, s, v = h_or_color 256 | else: h = h_or_color 257 | r, g, b = colorsys.hsv_to_rgb(h / 100.0, s / 100.0, v / 100.0) 258 | if a is not None: return r * 255, g * 255, b * 255, a 259 | return r * 255, g * 255, b * 255 260 | 261 | 262 | def rgb2hsv(r_or_color: Union[tuple, int], g: int = 0, b: int = 0, a: int = None) -> tuple: 263 | """Convert rgb color to hsv color. 264 | 265 | :param r_or_color: The 'red' value or a color tuple. 266 | :param g: The 'green' value. 267 | :param b: The 'blue' value. 268 | :param a: The 'alpha' value. 269 | :return: The converted hsv tuple color. 270 | """ 271 | 272 | if type(r_or_color).__name__ == "tuple": 273 | if len(r_or_color) == 4: 274 | r, g, b, a = r_or_color 275 | else: 276 | r, g, b = r_or_color 277 | else: r = r_or_color 278 | h, s, v = colorsys.rgb_to_hsv(r / 255.0, g / 255.0, b / 255.0) 279 | if a is not None: return h * 100, s * 100, v * 100, a 280 | return h * 100, s * 100, v * 100 281 | 282 | 283 | def hex2rgb(hex: str) -> tuple: 284 | """Convert hex color to rgb color. 285 | 286 | :param hex: The hexadecimal string ("xxxxxx"). 287 | :return: The converted rgb tuple color. 288 | """ 289 | 290 | if len(hex) < 6: hex += "0"*(6-len(hex)) 291 | elif len(hex) > 6: hex = hex[0:6] 292 | rgb = tuple(int(hex[i:i+2], 16) for i in (0,2,4)) 293 | return rgb 294 | 295 | 296 | def rgb2hex(r_or_color: Union[tuple, int], g: int = 0, b: int = 0, a: int = 0) -> str: 297 | """Convert rgb color to hex color. 298 | 299 | :param r_or_color: The 'red' value or a color tuple. 300 | :param g: The 'green' value. 301 | :param b: The 'blue' value. 302 | :param a: The 'alpha' value. 303 | :return: The converted hexadecimal color. 304 | """ 305 | 306 | if type(r_or_color).__name__ == "tuple": r, g, b = r_or_color[:3] 307 | else: r = r_or_color 308 | hex = '%02x%02x%02x' % (int(r), int(g), int(b)) 309 | return hex 310 | 311 | 312 | def hex2hsv(hex: str) -> tuple: 313 | """Convert hex color to hsv color. 314 | 315 | :param hex: The hexadecimal string ("xxxxxx"). 316 | :return: The converted hsv tuple color. 317 | """ 318 | 319 | return rgb2hsv(hex2rgb(hex)) 320 | 321 | 322 | def hsv2hex(h_or_color: Union[tuple, int], s: int = 0, v: int = 0, a: int = 0) -> str: 323 | """Convert hsv color to hex color. 324 | 325 | :param h_or_color: The 'hue' value or a color tuple. 326 | :param s: The 'saturation' value. 327 | :param v: The 'value' value. 328 | :param a: The 'alpha' value. 329 | :return: The converted hexadecimal color. 330 | """ 331 | 332 | if type(h_or_color).__name__ == "tuple": h, s, v = h_or_color[:3] 333 | else: h = h_or_color 334 | return rgb2hex(hsv2rgb(h, s, v)) 335 | 336 | 337 | # toplevel functions 338 | 339 | __instance = None 340 | __lightTheme = False 341 | __useAlpha = False 342 | 343 | 344 | def useAlpha(value=True) -> None: 345 | """Set if the ColorPicker should display an alpha field. 346 | 347 | :param value: True for alpha field, False for no alpha field. Defaults to True 348 | :return: 349 | """ 350 | global __useAlpha 351 | __useAlpha = value 352 | 353 | 354 | def useLightTheme(value=True) -> None: 355 | """Set if the ColorPicker should use the light theme. 356 | 357 | :param value: True for light theme, False for dark theme. Defaults to True 358 | :return: None 359 | """ 360 | 361 | global __lightTheme 362 | __lightTheme = value 363 | 364 | 365 | def getColor(lc: tuple = None) -> tuple: 366 | """Shows the ColorPicker and returns the picked color. 367 | 368 | :param lc: The color to display as previous color. 369 | :return: The picked color. 370 | """ 371 | 372 | global __instance 373 | 374 | if __instance is None: 375 | __instance = ColorPicker(useAlpha=__useAlpha, lightTheme=__lightTheme) 376 | 377 | if __useAlpha != __instance.usingAlpha or __lightTheme != __instance.usingLightTheme: 378 | del __instance 379 | __instance = ColorPicker(useAlpha=__useAlpha, lightTheme=__lightTheme) 380 | 381 | return __instance.getColor(lc) 382 | 383 | --------------------------------------------------------------------------------