Interface ShadowColor

All Superinterfaces:
ARGBLike, ComponentBuilderApplicable, RGBLike, StyleBuilderApplicable

public interface ShadowColor extends StyleBuilderApplicable, ARGBLike
A shadow color which may be applied to a Style.

Similar to TextColor, except that shadows contain alpha information.

Since:
4.18.0
Since Minecraft:
1.21.4
  • Method Summary

    Modifier and Type
    Method
    Description
    default @Range(from=0L,to=255L) int
    Get the alpha component of the shadow colour.
    default String
    Represent this shadow color as a #-prefixed hex string.
    default @Range(from=0L,to=255L) int
    Get the blue component of the shadow colour.
    static @Nullable ShadowColor
    Attempt to parse a shadow colour from a #-prefixed hex string.
    default @Range(from=0L,to=255L) int
    Get the green component of the shadow colour.
    lerp(float t, ARGBLike a, ARGBLike b)
    Linearly interpolates between a and b by t.
    Return a shadow color that will disable the shadow on a component.
    default @Range(from=0L,to=255L) int
    red()
    Get the red component of the shadow colour.
    shadowColor(@Range(from=0L,to=255L) int red, @Range(from=0L,to=255L) int green, @Range(from=0L,to=255L) int blue, @Range(from=0L,to=255L) int alpha)
    Create a new shadow color from individual red, green, blue, and alpha values.
    shadowColor(int argb)
    Create a new shadow color from the ARGB value packed in an int.
    Create a shadow color from an existing ARGB colour.
    shadowColor(RGBLike rgb, @Range(from=0L,to=255L) int alpha)
    Create a shadow color from an existing colour plus an alpha value.
    default void
    Applies to style.
    int
    The int-packed ARGB value of this shadow colour.

    Methods inherited from interface RGBLike

    asHSV

    Methods inherited from interface StyleBuilderApplicable

    componentBuilderApply
  • Method Details

    • lerp

      static ShadowColor lerp(float t, ARGBLike a, ARGBLike b)
      Linearly interpolates between a and b by t.

      This returns a color blended between color a, at t=0.0, and color b, at t=1.0.

      Parameters:
      t - the interpolation value, between 0.0 and 1.0 (both inclusive)
      a - the lower bound (t=0.0)
      b - the upper bound (t=1.0)
      Returns:
      the interpolated value, a color between the two input colors a and b
      Since:
      4.18.0
    • none

      static ShadowColor none()
      Return a shadow color that will disable the shadow on a component.
      Returns:
      a disabling shadow color
      Since:
      4.18.0
    • shadowColor

      @Contract(pure=true) static ShadowColor shadowColor(int argb)
      Create a new shadow color from the ARGB value packed in an int.

      This int will be in the format 0xAARRGGBB

      Parameters:
      argb - the int-packed ARGB value
      Returns:
      a shadow color
      Since:
      4.18.0
    • shadowColor

      @Contract(pure=true) static ShadowColor shadowColor(@Range(from=0L,to=255L) int red, @Range(from=0L,to=255L) int green, @Range(from=0L,to=255L) int blue, @Range(from=0L,to=255L) int alpha)
      Create a new shadow color from individual red, green, blue, and alpha values.
      Parameters:
      red - the red value
      green - the green value
      blue - the blue value
      alpha - the alpha
      Returns:
      a shadow colour
      Since:
      4.18.0
    • shadowColor

      @Contract(pure=true) static ShadowColor shadowColor(RGBLike rgb, @Range(from=0L,to=255L) int alpha)
      Create a shadow color from an existing colour plus an alpha value.
      Parameters:
      rgb - the existing color
      alpha - the alpha
      Returns:
      a shadow colour
      Since:
      4.18.0
    • shadowColor

      static ShadowColor shadowColor(ARGBLike argb)
      Create a shadow color from an existing ARGB colour.
      Parameters:
      argb - the existing color
      Returns:
      a shadow colour
      Since:
      4.18.0
    • fromHexString

      @Contract(pure=true) static @Nullable ShadowColor fromHexString(@Pattern("#[0-9a-fA-F]{8}") String hex)
      Attempt to parse a shadow colour from a #-prefixed hex string.

      This string must be in the format #RRGGBBAA

      Parameters:
      hex - the input value
      Returns:
      a shadow color if possible, or null if any components are invalid
      Since:
      4.18.0
    • asHexString

      default String asHexString()
      Represent this shadow color as a #-prefixed hex string.

      This string will be in the format #RRGGBBAA

      Returns:
      the hex string representation of this shadow colour
      Since:
      4.18.0
    • red

      default @Range(from=0L,to=255L) int red()
      Get the red component of the shadow colour.
      Specified by:
      red in interface RGBLike
      Returns:
      the red component, in the range [0x0, 0xff]
      Since:
      4.18.0
    • green

      default @Range(from=0L,to=255L) int green()
      Get the green component of the shadow colour.
      Specified by:
      green in interface RGBLike
      Returns:
      the green component, in the range [0x0, 0xff]
      Since:
      4.18.0
    • blue

      default @Range(from=0L,to=255L) int blue()
      Get the blue component of the shadow colour.
      Specified by:
      blue in interface RGBLike
      Returns:
      the blue component, in the range [0x0, 0xff]
      Since:
      4.18.0
    • alpha

      default @Range(from=0L,to=255L) int alpha()
      Get the alpha component of the shadow colour.
      Specified by:
      alpha in interface ARGBLike
      Returns:
      the alpha component, in the range [0x0, 0xff]
      Since:
      4.18.0
    • value

      int value()
      The int-packed ARGB value of this shadow colour.
      Returns:
      the shadow colour value
      Since:
      4.18.0
    • styleApply

      default void styleApply(Style.Builder style)
      Description copied from interface: StyleBuilderApplicable
      Applies to style.
      Specified by:
      styleApply in interface StyleBuilderApplicable
      Parameters:
      style - the style builder