Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hsb precision opacity #657

Closed
wants to merge 10 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import javafx.scene.shape.Circle;

import java.io.IOException;
import java.text.DecimalFormat;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -454,8 +455,9 @@ private Color updateUI(double hue, double saturation, double brightness, double

// Set TextFields value
hue_textfield.setText(String.valueOf((int) hue));
saturation_textfield.setText(String.valueOf((int) (saturation * 100)));
brightness_textfield.setText(String.valueOf((int) (brightness * 100)));
DecimalFormat format = new DecimalFormat("0.##");
saturation_textfield.setText(format.format(saturation * 100));
brightness_textfield.setText(format.format(brightness * 100));
double alpha_rounded = round(alpha, 100); // 2 decimals rounding
alpha_textfield.setText(Double.toString(alpha_rounded));
red_textfield.setText(Integer.toString(red));
Expand Down