Package valorless.rarespawns.utils
Class ColorUtils
java.lang.Object
valorless.rarespawns.utils.ColorUtils
Utilities for parsing and resolving Bukkit
Color instances.
Supports multiple input formats:
- Named colors (case-insensitive): red, blue, green, yellow, purple, white, black, gray, aqua, fuchsia, lime, maroon, navy, olive, orange, silver, teal
- Hex colors: #RRGGBB or RRGGBB
- RGB triplets: "R,G,B" (0-255 each)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.ColorgetColorFromString(String input) Parses a Color from a human-friendly string.static org.bukkit.ColorRetrieves a predefined Color by its name.
-
Constructor Details
-
ColorUtils
public ColorUtils()
-
-
Method Details
-
valueOf
Retrieves a predefined Color by its name.- Parameters:
name- The name of the color (case-insensitive).- Returns:
- The Color object, or null if no match is found.
- Throws:
IllegalArgumentException- if name is null
-
getColorFromString
Parses a Color from a human-friendly string.Accepted formats (case-insensitive):
- Named colors: red, blue, green, yellow, purple, white, black, gray, aqua, fuchsia, lime, maroon, navy, olive, orange, silver, teal
- Hex: #RRGGBB or RRGGBB
- RGB: "R,G,B" with each component 0-255
- Parameters:
input- the input string to parse (trimmed, case-insensitive)- Returns:
- the parsed Color
- Throws:
IllegalArgumentException- if the input format is unknown or invalid
-