API Review RT-19711: Color.web should parse rgb() and hsl() formats

Jim Graham james.graham at oracle.com
Wed Apr 18 17:34:42 PDT 2012


Jira: http://javafx-jira.kenai.com/browse/RT-19711

CSS3 contains some new formats for color strings that are already used 
in many places on the web, but are not parsed by our Color.web() 
factory.  I noticed frequent use of these new formats in HTML5 Canvas 
examples and SVG documents so their use should be familiar to many web 
application developers.

The formats are as specified by the W3 CSS3 color documents:

http://www.w3.org/TR/css3-color/#rgb-color
http://www.w3.org/TR/css3-color/#rgba-color
http://www.w3.org/TR/css3-color/#hsl-color
http://www.w3.org/TR/css3-color/#hsla-color

All of these factory calls:

Color.web("rgb(255,255,255)");
Color.web("rgba(255,255,255,1.0)");
Color.web("hsl(360,100%,100%)");
Color.web("hsla(360,100%,100%,1.0)");

should all generate opaque white colors...

             ...jim


More information about the openjfx-dev mailing list