-
Enhancement
-
Resolution: Unresolved
-
P4
-
fx2.1
I recently had to convert a javafx.util.Color to its web representation.
What I ended up doing is, I used a substring of the toString() method and added the #.
String style = "-fx-background-color: #" + color.toString().substring(2, color.get().toString().length() - 2);
I also had to cut the alpha value.
It might be helpful, if there was a method on the color object which converts it to the web color.
Something like this:
Color color = Color.BLUE;
String webColor = color.toWeb(); // #0000FF
What I ended up doing is, I used a substring of the toString() method and added the #.
String style = "-fx-background-color: #" + color.toString().substring(2, color.get().toString().length() - 2);
I also had to cut the alpha value.
It might be helpful, if there was a method on the color object which converts it to the web color.
Something like this:
Color color = Color.BLUE;
String webColor = color.toWeb(); // #0000FF
- relates to
-
JDK-8120028 Color.web() should parse "rgb(#,#,#)" and "rgba(#,#,#,#)" syntaxes
-
- Resolved
-