Class ColorUtil

java.lang.Object
ch.swingfx.color.ColorUtil

public final class ColorUtil extends Object
Utility for working with colors
  • Constructor Details

    • ColorUtil

      private ColorUtil()
  • Method Details

    • withAlpha

      public static Color withAlpha(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