Color.toWeb & Color.toHexString
pavel.safrata at oracle.com
Mon Jul 23 06:59:29 PDT 2012
Yes, I know, the Color.web() parses it as well.
On 23.7.2012 15:32, David Grieve wrote:
> Alpha isn't standard in a hex color, but the JavaFX CSS parser will
> parse #rgba or #rrggbbaa
> On Jul 17, 2012, at 4:56 AM, Pavel Safrata wrote:
>> 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.
> David Grieve | Principal Member of Technical Staff
> Mobile: +16033121013 <tel:+16033121013>
> Oracle Java Client UI and Tools
> Durham, NH 03824
> <http://www.oracle.com/commitment> Oracle is committed to developing
> practices and products that help protect the environment
More information about the openjfx-dev