Interface ColorConverter


public interface ColorConverter
Recognizes and converts the color formats accepted in configs, namely legacy codes, named colors and hex values.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The background used when a hex color cannot be parsed.
    static final List<String>
    Every legacy color and decoration code the plugin recognizes.
    static final List<String>
    Every named adventure color, written as the MiniMessage tag that produces it.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable String
    Checks that a color is one this plugin understands.
    int
    Converts a hex color to a packed ARGB integer.
  • Field Details

    • DEFAULT_BACKGROUND_COLOR

      static final int DEFAULT_BACKGROUND_COLOR
      The background used when a hex color cannot be parsed.
      See Also:
    • LEGACY_COLORS

      static final List<String> LEGACY_COLORS
      Every legacy color and decoration code the plugin recognizes.
    • NAMED_COLORS

      static final List<String> NAMED_COLORS
      Every named adventure color, written as the MiniMessage tag that produces it.
  • Method Details

    • isCorrect

      @Nullable String isCorrect(String color)
      Checks that a color is one this plugin understands.
      Parameters:
      color - the color to check
      Returns:
      the normalized color, or null if it is not recognized
    • parseHexToArgb

      int parseHexToArgb(String hex)
      Converts a hex color to a packed ARGB integer.
      Parameters:
      hex - the hex color, with or without a leading hash
      Returns:
      the packed ARGB value, or DEFAULT_BACKGROUND_COLOR if the text is not valid hex