Class ConsoleColorSerializer
java.lang.Object
dev.ua.theroer.magicutils.logger.ConsoleColorSerializer
Serializes log
Components for console output, preferring ANSI colors when the
adventure ANSI serializer is on the classpath and falling back to plain text otherwise.
The ANSI serializer is loaded reflectively so platforms without it (lean shaded jars, older Bungee/Fabric builds) still work — they simply receive uncolored text.
-
Method Details
-
serialize
Serializes a component to ANSI-colored text when possible, otherwise to plain text.- Parameters:
component- component to serialize, may benull- Returns:
- rendered string, or empty string when component is
null
-
ansiAvailable
public static boolean ansiAvailable()Checks if ANSI color serialization is available in the current environment.- Returns:
truewhen the ANSI serializer was successfully loaded and colors will be emitted
-