Color.toWeb & Color.toHexString

Pavel Safrata pavel.safrata at
Tue Jul 10 07:50:12 PDT 2012

based on Jira issue
I propose the following new methods to Color class (targeting Lombard):

public String toWeb()

This method will return the simplest string representation of the color 
using one of the following notations:

rgb(r, g, b)
rgba(r, g, b, a)

The resulting string, when passed to Color.toWeb(), will produce an 
eqivalent color.

public String toHexString()

This method will return a string rrggbb without the leading hash. It 
will ignore opacity and will round the values to the nearest color that 
can be represented with such string. An example of use is displaying a 
web-based color value in a color picker.


More information about the openjfx-dev mailing list