Class ColorUtils

java.lang.Object
dev.ua.theroer.magicutils.utils.ColorUtils

public final class ColorUtils extends Object
Utility methods for color calculations and MiniMessage helper conversions.
  • Method Details

    • adjustBrightness

      public static String adjustBrightness(String hex, float factor)
      Adjust color brightness by factor.
      Parameters:
      hex - the hex color string (e.g., "#ff0000")
      factor - brightness multiplier (1.0 = no change, >1.0 = brighter)
      Returns:
      adjusted hex color string
    • adjustHue

      public static String adjustHue(String hex, int hueShift)
      Adjust color hue by degrees.
      Parameters:
      hex - the hex color string (e.g., "#ff0000")
      hueShift - degrees to shift hue (-360 to 360)
      Returns:
      adjusted hex color string
    • getMainAndSecondaryColor

      public static String[] getMainAndSecondaryColor(String name)
      Get primary and secondary colors derived from plugin name.
      Parameters:
      name - the plugin name to generate colors from
      Returns:
      array containing [primary, secondary] hex colors
    • createGradientTag

      public static String createGradientTag(String[] colors)
      Create gradient tag from colors array.
      Parameters:
      colors - array of hex color strings
      Returns:
      MiniMessage gradient tag (e.g., "<gradient:#ff0000:#00ff00>")
    • legacyToMiniMessage

      public static String legacyToMiniMessage(String input)
      Converts legacy color codes to MiniMessage codes.
      Parameters:
      input - string with legacy color codes (&a, &#ff0000, etc.)
      Returns:
      string with MiniMessage tags (<green>, <#ff0000>, etc.)
    • toLegacy

      public static String toLegacy(String input)
      Converts ampersand color codes to legacy section sign codes.
      Parameters:
      input - string with legacy color codes (&a, &#ff0000, etc.)
      Returns:
      string with section sign color codes