{"id":21155275,"url":"https://github.com/nlfmt/pyqt-colorpicker-widget","last_synced_at":"2025-07-09T11:31:36.633Z","repository":{"id":51123165,"uuid":"301207481","full_name":"nlfmt/pyqt-colorpicker-widget","owner":"nlfmt","description":"A custom Color Picker widget for PyQt5/PyQt6 applications.","archived":false,"fork":false,"pushed_at":"2021-05-22T23:20:16.000Z","size":86,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-03-09T05:36:46.686Z","etag":null,"topics":["color-picker","pyqt5","pyqt6","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nlfmt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-04T19:14:39.000Z","updated_at":"2023-01-29T18:33:11.000Z","dependencies_parsed_at":"2022-09-19T10:11:26.670Z","dependency_job_id":null,"html_url":"https://github.com/nlfmt/pyqt-colorpicker-widget","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlfmt%2Fpyqt-colorpicker-widget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlfmt%2Fpyqt-colorpicker-widget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlfmt%2Fpyqt-colorpicker-widget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlfmt%2Fpyqt-colorpicker-widget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nlfmt","download_url":"https://codeload.github.com/nlfmt/pyqt-colorpicker-widget/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225537774,"owners_count":17485092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["color-picker","pyqt5","pyqt6","python3"],"created_at":"2024-11-20T11:17:17.237Z","updated_at":"2024-11-20T11:17:17.971Z","avatar_url":"https://github.com/nlfmt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyQt Color Picker\n\nSimple Color Picker Widget created with PyQt to easily get color input from the user.\n\n![colorpicker_widget](https://user-images.githubusercontent.com/71983360/95210784-233feb80-07ec-11eb-94fb-3fb1efc48ae3.png)\n\n\n## Usage\n\n1. To use the Color Picker Widget in a PyQt project make sure you have the `PyQt5` or `PyQt6` library:\n\n   ```\n   pip install PyQt5\n   ```\n   ```\n   pip install PyQt6\n   ```\n\n   then add the `colorpicker` folder of your PyQt version into your project folder and import `ColorPicker`\n\n   ```python\n   from colorpicker import ColorPicker\n   ```\n\n2. To add the widget to your app, create a `360x200` placeholder widget in your ui and add the colorpicker to it.\n   When initializing the Color Picker you have the option to pass an initial color to it.\n\n   ```python\n   colorpicker = ColorPicker(my_placeholder) # initial color is black\n\n   colorpicker = ColorPicker(my_placeholder, rgb=(255,127,0))     # Use RGB\n   colorpicker = ColorPicker(my_placeholder, hsv=(90,80,20))      # Use HSV\n   colorpicker = ColorPicker(my_placeholder, hex=\"33ff88\")        # Use Hex\n   ```\n\n   You can then run `getRGB`/`getHSV`/`getHex` method to get the currently selected color:\n\n   ```python\n   current_color = colorpicker.getRGB()\n   ```\n\n\n* `getRGB` returns a rgb tuple with values from 0-255,\n* `getHSV` returns a hsv tuple with values from 0-100,\n* `getHex` returns a string without hashtag.\n\n* You can customize the ranges easily:\n\n   ```python\n   hsv = colorpicker.getHSV(360,1)  # hue in degrees, saturation \u0026 value from 0 to 1\n   rgb = colorpicker.getRGB(100)    # rgb in percent\n   hex = colorpicker.getHex(True)   # use hashtag in string\n   ```\n\n* You can also set the current color:\n\n    ```python\n    colorpicker.setHSV((50,20,80))      # 0-100\n    colorpicker.setRGB((221,34,21))     # 0-255\n    colorpicker.setHex(\"dd3322\")        # no hashtag\n    ```\n\n* Use ColorPicker's `colorChanged` signal to update directly when the user changes the color:\n\n  ```python\n  colorpicker.colorChanged.connect(my_function)\n\n  def my_function():\n    print(colorpicker.getColor())\n  ```\n\n* For an example with a bigger application based on a main class, look at the `example.py` file.\n\n\u003csup\u003e**[Why should you consider using Qt6 | Scaling Issues?](https://imgur.com/a/8mGuCiJ)**\u003c/sup\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlfmt%2Fpyqt-colorpicker-widget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnlfmt%2Fpyqt-colorpicker-widget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlfmt%2Fpyqt-colorpicker-widget/lists"}