Color.toWeb & Color.toHexString
pavel.safrata at oracle.com
Tue Jul 17 02:24:59 PDT 2012
On 17.7.2012 11:09, Tom Schindl wrote:
> Am 17.07.12 10:56, schrieb Pavel Safrata:
>> On 17.7.2012 6:11, Jim Graham wrote:
>>> I had similar questions to Rich, but I had one additional question:
>>> On 7/10/2012 7:50 AM, Pavel Safrata wrote:
>>>> 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 ignore opacity?
>> This one is disputable. I based it on the mentioned use-case where you
>> edit the color in a color picker and I've never seen an application
>> where opacity would be part of that field. Also AFAIK expressing opacity
>> as 256-based value is not a common thing at all - for instance it
>> wouldn't be parsed by any CSS engine, would it? But I'm not sure this
>> justifies for ignoring the opacity, maybe we should produce the string
>> expressing the color as close as possible.
> I would vote for getting the opacity always or if you want a method that
> allows to suppress it pass a boolean flag to suppress it.
You are probably right, guys. After all one can always call substring
when the color picker is shown..
More information about the openjfx-dev