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

Provide a "toWeb()" method for the Color class

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P4
    • tbd
    • fx2.1
    • javafx

    Description

      I recently had to convert a javafx.util.Color to its web representation.

      What I ended up doing is, I used a substring of the toString() method and added the #.

      String style = "-fx-background-color: #" + color.toString().substring(2, color.get().toString().length() - 2);

      I also had to cut the alpha value.

      It might be helpful, if there was a method on the color object which converts it to the web color.

      Something like this:

      Color color = Color.BLUE;
      String webColor = color.toWeb(); // #0000FF

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cschudtjfx Christian Schudt (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Imported: