Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8092406

Color.web(String) should not be documented to accept rgba hex constants

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • fx2.0
    • javafx
    • None

      RT-6039, back in JavaFX 1.3, changed Color.web(String) to recognize an eight-digit hex form "#rrggbbaa" in addition to the standard six-digit one. In my opinion this was a mistake. The CSS standard does not recognize an eight-digit form, and indeed states explicitly at http://www.w3.org/TR/css3-color/#rgba-color : "Unlike RGB values, there is no hexadecimal notation for an RGBA value." The name of this method (Color.web) implies that it takes a web specification of the color, which we might hope would be a *standard* web specification. Additionally, this mutant syntax requires us to define what happens when you use the second form of Color.web that has its own opacity parameter.

      For compatibility reasons we probably want to keep recognizing the eight-digit form, but I would suggest that we remove any mention of it from the documentation and samples. Our CSS engine also recognizes it, and there likewise I suggest we should continue to recognize it but not use it in anything we ship. The FXML loader passes color specs to Color.web and therefore implicitly recognizes #rrggbbaa too; I would suggest that it be extended to recognize the standard rgba(r,g,b,a) syntax in addition.

            Unassigned Unassigned
            emcmanuswse Eamonn McManus (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported: