Package ch.swingfx.color
Class ColorUtil
- java.lang.Object
-
- ch.swingfx.color.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 255static java.awt.Color
withAlpha(java.awt.Color color, float alpha)
Creates a newColor
with RGB fromcolor
and the alpha value ofalpha
-
-
-
Method Detail
-
withAlpha
public static java.awt.Color withAlpha(java.awt.Color color, float alpha)
Creates a newColor
with RGB fromcolor
and the alpha value ofalpha
- Parameters:
color
-Color
you want to have withalpha
alpha
- alpha value you want to set. Must be between 0f and 1f- Returns:
- new
Color
withalpha
-
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
-
-