code: private String getInputFontColor(String backgroundColor) {
  
          if ((backgroundColor != null) && (backgroundColor.indexOf("#") == 0)) {
              // remove the "#" from the color string
              backgroundColor = backgroundColor.substring(1);
              int colorValue = 50001;
              try {
                  // calculate int value of color
                  colorValue = Integer.parseInt(backgroundColor, 16);
              } catch (NumberFormatException nf) {
                  // this should never happen
              }
              if (colorValue < 50000) {
                  // for dark colors set font color to white
                  return "#FFFFFF";
              } else {
                  // for other colors use black
                  return "#000000";
              }
          }
          return "#000000";
      }
docs: Returns the font color of the input field depending on the selected color value.<p>
  
  @param backgroundColor the selected color value which is displayed as the input field background
  @return the font color to use