Color.toWeb & Color.toHexString

Pavel Safrata pavel.safrata at oracle.com
Tue Jul 17 01:56:27 PDT 2012


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.

Thanks,
Pavel

>
>             ...jim




More information about the openjfx-dev mailing list