Class ColorUtils

java.lang.Object
valorless.rarespawns.utils.ColorUtils

public class ColorUtils extends Object
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 Details

    • ColorUtils

      public ColorUtils()
  • Method Details

    • valueOf

      public static org.bukkit.Color valueOf(String name)
      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

      public static org.bukkit.Color getColorFromString(String input)
      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