public static Color toColor(String colorString) {
   Color color = null;
   try {
     color = ColorConverter.get(colorString);
   } catch (ColorConversionException e) {
     e.printStackTrace();
   } catch (NullPointerException e) {
     e.printStackTrace();
   }
   return color;
 }
  public static Color toColor(ITextStyle style) {
    // Color.
    Color color = null;

    try {
      // Get the basic color.
      color = ColorConverter.get(style.color());

      // Apply opacity setting.
      color = getTransparentColor(color, style.opacity());

    } catch (ColorConversionException e) {
      e.printStackTrace();
    } catch (NullPointerException e) {
      // e.printStackTrace();
    }

    return color;
  }