Color.toWeb & Color.toHexString
richard.bair at oracle.com
Tue Jul 10 09:27:33 PDT 2012
On Jul 10, 2012, at 7:50 AM, Pavel Safrata wrote:
> 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.
I like the idea that color.equals(Color.web(color.toWeb())).
How do we determine which format is going to be returned by toWeb? I think it should be consistent (ie: pick one to use all the time). Otherwise it becomes arbitrary and folks cannot easily parse the results or do what they need with it.
> 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.
Why remove the #? What is the use case for toHexString()?
More information about the openjfx-dev