Class ColorUtils

java.lang.Object
me.emafire003.dev.coloredglowlib.util.ColorUtils

public class ColorUtils extends Object
  • Field Details

  • Constructor Details

    • ColorUtils

      public ColorUtils()
  • Method Details

    • isHexColor

      public static boolean isHexColor(String str)
      Checks if a given String represents a Color in Hexadecimal format. The string can start with or without "#"
      Parameters:
      str - The supposed string color to check
      Returns:
      Returns weather teh givin string is a color or not
    • toColorValue

      public static int toColorValue(int r, int g, int b)
      Converts RGB decimal numbers into a single Color value
      Parameters:
      r - The red RGB value (0-255)
      g - The green RGB value (0-255)
      b - The blue RGB value (0-255)
    • toColorValue

      public static int toColorValue(String hex)
      Converts a given string to an integer Color value The string is checked with isHexColor to confirm it's indeed a color in hex string format. The string can start with or without "#"
      Parameters:
      hex - The string representing the color in hexadecimal format
      Returns:
      Returns the color value corresponding to the string, or black if the string was not a color
    • toHex

      public static String toHex(int colorValue)
      Converts a given integer Color value to an
    • toHex

      public static String toHex(int r, int g, int b)
    • checkDefault

      public static boolean checkDefault(String color)
    • checkSameColor

      public static boolean checkSameColor(String color, String color1)
    • toRGB

      public static int[] toRGB(String color)
    • isValidColor

      public static boolean isValidColor(String color)
      Checks is a given string is actually a valid color

      It's here instead of in the API because it is sometimes needed before the server loads

    • isValidColorOrCustom

      public static boolean isValidColorOrCustom(String color)
      Checks is a given string is actually a valid color

      It's here instead of in the API because it is sometimes needed before the server loads

    • isCustomAnimation

      public static boolean isCustomAnimation(String color)
      Checks if a given color is a custom animation added by a datapack