Skip to content

Color Picker

Pawel Pastuszak edited this page Dec 7, 2018 · 10 revisions

Color Picker (source) allows user to choose color. Picker was added in VisUI 0.6.0

Color Picker SS

User can chose new color using HSV or RGB system. He can also enter hex rgb value. User can change color alpha. In text fields user can press plus or minus numpad key to quickly increment or decrement field value. Pressing plus or minus key with left shift will change value by 10.

Color picker is a heavy widget and should be reused whenever possible, picker unlike other VisUI widgets must be disposed (by calling picker.dispose()) when no longer needed.

Usage:

//picker creation
ColorPicker picker = new ColorPicker(new ColorPickerAdapter() {
	@Override
	public void finished (Color newColor) {
		image.setColor(newColor);
	}
});

//...

showPickerButton.addListener(new ChangeListener() {
	@Override
	public void changed (ChangeEvent event, Actor actor) {
                //displaying picker with fade in animation
		getStage().addActor(picker.fadeIn());
	}
});

ColorUtils

Class that provides unities to convert HSV to RGB color system and vice-versa.