Class ColorUtils

java.lang.Object
me.hsgamer.hscore.bukkit.utils.ColorUtils

public final class ColorUtils extends Object
Methods to colorize strings
  • Method Details

    • replaceHybridColorCode

      @NotNull public static @NotNull String replaceHybridColorCode(char indicator, String input)
      Replace the hybrid color format to the final color. The format is "?(#[A-Fa-f\\d]{1,6},[a-zA-Z\\d])", where ? is the indicator character and (#[A-Fa-f\\d]{1,6},[a-zA-Z\\d]) is the code.
      Parameters:
      indicator - the indicator character
      input - the input string
      Returns:
      the converted string
    • colorize

      @NotNull public static @NotNull String colorize(@NotNull @NotNull String input)
      Convert to colored string
      Parameters:
      input - the string
      Returns:
      the colored string
    • colorizeHex

      @NotNull public static @NotNull String colorizeHex(char altColorChar, @NotNull @NotNull String input)
      Convert HEX string to color. The HEX string format is "?#rrggbb", where "?" is the alternative color char
      Parameters:
      altColorChar - the alternative color char
      input - the string
      Returns:
      the colored string
    • colorize

      @NotNull public static @NotNull String colorize(char altColorChar, @NotNull @NotNull String input)
      Convert to colored string
      Parameters:
      altColorChar - the alternative color char
      input - the string
      Returns:
      the colored string
    • getRandomColor

      @NotNull public static @NotNull org.bukkit.ChatColor getRandomColor()
      Get a random chat color
      Returns:
      the chat color
    • setHexSupportGlobalCheck

      public static void setHexSupportGlobalCheck(BooleanSupplier hexSupportGlobalCheck)
      Set the global predicate that checks if the server supports hex colors
      Parameters:
      hexSupportGlobalCheck - the predicate