code: public static String asHexWithAlpha( Color color ) {
          int r = color.getRed();
          int g = color.getGreen();
          int b = color.getBlue();
          int a = color.getAlpha();
  
          String hex = String.format("#%02x%02x%02x%02x", r, g, b, a);
          return hex;
      }
docs: Convert a color to its hex representation.
  
  @param color the color to convert.
  @return the hex.