In this article we will see how we can set the custom color in the QColorDialog widget. Custom colors the color made by the user they can be set at the run time with the help of mouse although we can add custom color programmatically, by default all custom colors are white. Below is how the custom color in color dialog looks like
In order to do this we use
setCustomColor method with the QColorDialog object
Syntax : dialog.setCustomColor(i, color)
Argument : It takes integer i.e index and QColor object as argument
Return : It returns None
Note : This function does not apply to the Native Color Dialog on the macOS platform. If you still require this function, use the QColorDialog.DontUseNativeDialog option.
Below is the implementation
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course