I have a settings UI in one of my addons that allows to choose a color but I don't know how to display this small colored square.
This square show which color ahs been chosen and opens the built-in ColorPicker when clicked.
I looked into some addons - like RatingBuster or GatherMate2 for example - but didn't understand how these squares are made and displayed in the settings UI.