Skip to content

omega0verride/PyQt-ColorPicker

Repository files navigation

PyQt-ColorPicker

A new design for PyQt ColorPicker.

The color circle is a simple image. The hue values are generated by finding the tangent of the distance of the mouse coordinates in respect to the center coordinates within the colorpicker widget.

Make sure that all the files are in the same directory with the executable/script or change the corresponding paths.

If you change the width, the pointer might be a bit off, this can be fixed by setting pointer_distance_correction.

Simple example that prints the HSV color code:

import sys

from PyQt6.QtWidgets import QApplication

from QtColorPicker import QtColorPicker

app = QApplication(sys.argv)
QtColorPicker(listener=lambda h, s, v: print(f"color: ({h}, {s}, {v})")).show()
sys.exit(app.exec())

Note - If you use this as a widget set object names for QPushButtons and QSliders of parent because it affects the child widget.