Class AlphaColor

java.lang.Object
net.minestom.server.color.Color
net.minestom.server.color.AlphaColor
All Implemented Interfaces:
RGBLike

public final class AlphaColor extends Color
A general purpose class for representing colors.

Colors must be in the range of 0-255.

  • Field Details

  • Constructor Details

    • AlphaColor

      public AlphaColor(int alpha, int red, int green, int blue)
    • AlphaColor

      public AlphaColor(int argb)
      Creates an alpha color from an integer. This is done by reading each color component from the lowest order 32 bits of the integer, and creating a color from those components.
      Parameters:
      argb - the integer
    • AlphaColor

      public AlphaColor(int alpha, @NotNull @NotNull RGBLike rgbLike)
      Creates a color from an RGB-like color.
      Parameters:
      rgbLike - the color
  • Method Details

    • withRed

      @NotNull public @NotNull AlphaColor withRed(int red)
      Overrides:
      withRed in class Color
    • withGreen

      @NotNull public @NotNull AlphaColor withGreen(int green)
      Overrides:
      withGreen in class Color
    • withBlue

      @NotNull public @NotNull AlphaColor withBlue(int blue)
      Overrides:
      withBlue in class Color
    • withAlpha

      @NotNull public @NotNull AlphaColor withAlpha(int alpha)
      Overrides:
      withAlpha in class Color
    • asARGB

      public int asARGB()
      Gets the color as an RGB integer.
      Returns:
      An integer representation of this color, as 0xRRGGBB
    • alpha

      public int alpha()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Color
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Color
    • toString

      public String toString()
      Overrides:
      toString in class Color