Package me.hsgamer.hscore.bukkit.utils
Class ColorUtils
java.lang.Object
me.hsgamer.hscore.bukkit.utils.ColorUtils
Methods to colorize strings
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull String
Convert to colored stringstatic @NotNull String
Convert to colored stringstatic @NotNull String
colorizeHex
(char altColorChar, @NotNull String input) Convert HEX string to color.static @NotNull org.bukkit.ChatColor
Get a random chat colorstatic @NotNull String
replaceHybridColorCode
(char indicator, String input) Replace the hybrid color format to the final color.static void
setHexSupportGlobalCheck
(BooleanSupplier hexSupportGlobalCheck) Set the global predicate that checks if the server supports hex colors
-
Method Details
-
replaceHybridColorCode
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 characterinput
- the input string- Returns:
- the converted string
-
colorize
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 charinput
- the string- Returns:
- the colored string
-
colorize
Convert to colored string- Parameters:
altColorChar
- the alternative color charinput
- 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
Set the global predicate that checks if the server supports hex colors- Parameters:
hexSupportGlobalCheck
- the predicate
-