Color.toWeb & Color.toHexString

Tom Schindl tom.schindl at
Tue Jul 17 02:09:23 PDT 2012

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.


B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
tom schindl                 geschäftsführer/CEO
eduard-bodem-gasse 5-7/1   A-6020 innsbruck     fax      ++43 512 935833                      phone    ++43 512 935834

More information about the openjfx-dev mailing list