Choose from a color wheel

I am building an app that gets color information from a color wheel and shows the LED in that color. Occasionally, selection is made outside the circle, and the background is white, so the information is transmitted. When choosing a color wheel, can you limit it so that it can be selected in a circle?

Use the Pythagorean Formula to verify the (x,y) point you touched
is within the circle radius R from the circle (x1,y1) center.

(x-x1)^2 + (y-y1)^2 < R^2

1 Like

This is what @ABG described, but in blocks. To use this you need to know the center x and y of the color wheel and its radius.

This method measures the distance in pixels between the current x,y being dragged and the center x,y of the wheel. If that distance is greater than the wheel radius, it means the finger is moving outside the wheel.

2 Likes

I think my colleagues solutions are best, but if the colour wheel itself does not contain white, then you could just reject a selection of white.

1 Like