Class ColorUtilities
public final class ColorUtilities
extends Object
Provides utility methods for colors.
-
Constructor Summary
Constructors
-
Method Summary
Converts a color string to a
Color
object.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ColorUtilities
public ColorUtilities()
-
Method Details
-
stringToColor
Converts a color string to a
Color
object.
The supported color string formats include:
- RGB format: "rgb(r,g,b)", e.g., "rgb(255,0,0)" for red.
- RGBA format: "rgba(r,g,b,a)", e.g., "rgba(255,0,0,0.5)" for red with 50% opacity.
- Hexadecimal: "#RGB" or "#RRGGBB", e.g., "#F00" or "#FF0000" for red.
- Hexadecimal with alpha: "#RGBA" or "#RRGGBBAA", e.g., "#F00C" or "#FF0000CC" for red with 90% opacity.
- Color name: A predefined color name, e.g., "red".
- Parameters:
colorString
- The color string to be converted.
- Returns:
- The
Color
object representing the color.