[IMPLEMENTED] Color chooser or color picker

As a UR+ developer for YouRing product, I would like ability to have a color chooser like javax.swing.colorchooser.AbstractColorChooserPanel so it can allow the user to easily select the color of the YouRing leds without inserting the RGB values.
The functionality of a color chooser is to allow the selection of a color from a palette.

1 Like

Thank you for submitting this feature request.
Other developers who find this request relevant should please elaborate on the use case below, or like the above post.

In 3.5 you can implement something like this:

 // HTML ------------------
 <!DOCTYPE html>
 <html>
 <head>
     <title>Title</title>
 	...
 </head>
 <body>
 <form>
     <div>
         <img id="map" width="128" height="128"/>
     </div>
 </form>
 </body>
 </html>

// ProgramNodeContribution
class YourProgramNodeContribution implements ProgramNodeContribution {

@Img(id = “map”)
private ImgComponent imgComponent;

public void openView() {
 ...
  	imgComponent.setImage(loadImage(fileName)); //<== Load your palette
 ...

}

@Touch(id = "map")

public void onTouch(TouchEvent touchEvent) {
if (touchEvent.getEventType() == TouchEvent.EventType.ON_PRESSED) {
int x = touchEvent.getRelativePosX();
int y = touchEvent.getRelativePosY();
Image image = imgComponent.getImage();
BufferedImage buffered = toBufferedImage(image);
int selectedColor = buffered.getRGB(x, y); // RGB Color < ===============
}
}
}

3 Likes

This feature request is now considered implemented!
Check out the release of PolyScope 5.0 and PolyScope 3.6 - and the SDK 1.3.55.

1 Like