Class ColorUtil


  • public final class ColorUtil
    extends java.lang.Object
    Utility for working with colors
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ColorUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int floatAlphaToIntAlpha​(float alpha)
      Converts a float value between 0f and 1f to an int value between 0 and 255
      static java.awt.Color withAlpha​(java.awt.Color color, float alpha)
      Creates a new Color with RGB from color and the alpha value of alpha
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ColorUtil

        private ColorUtil()
    • Method Detail

      • withAlpha

        public static java.awt.Color withAlpha​(java.awt.Color color,
                                               float alpha)
        Creates a new Color with RGB from color and the alpha value of alpha
        Parameters:
        color - Color you want to have with alpha
        alpha - alpha value you want to set. Must be between 0f and 1f
        Returns:
        new Color with alpha
      • floatAlphaToIntAlpha

        public static int floatAlphaToIntAlpha​(float alpha)
        Converts a float value between 0f and 1f to an int value between 0 and 255
        Parameters:
        alpha - value between 0f and 1f
        Returns:
        int value between 0 and 255