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 @org.jetbrains.annotations.Range(from=0L, to=255L) int
    Get the alpha component of the shadow colour.
    default @NotNull String
    Represent this shadow color as a #-prefixed hex string.
    default @org.jetbrains.annotations.Range(from=0L, to=255L) int
    Get the blue component of the shadow colour.
    static @Nullable ShadowColor
    fromHexString(@NotNull String hex)
    Attempt to parse a shadow colour from a #-prefixed hex string.
    default @org.jetbrains.annotations.Range(from=0L, to=255L) int
    Get the green component of the shadow colour.
    static @NotNull ShadowColor
    lerp(float t, @NotNull ARGBLike a, @NotNull ARGBLike b)
    Linearly interpolates between a and b by t.
    static @NotNull ShadowColor
    Return a shadow color that will disable the shadow on a component.
    default @org.jetbrains.annotations.Range(from=0L, to=255L) int
    red()
    Get the red component of the shadow colour.
    static @NotNull ShadowColor
    shadowColor(@org.jetbrains.annotations.Range(from=0L, to=255L) int red, @org.jetbrains.annotations.Range(from=0L, to=255L) int green, @org.jetbrains.annotations.Range(from=0L, to=255L) int blue, @org.jetbrains.annotations.Range(from=0L, to=255L) int alpha)
    Create a new shadow color from individual red, green, blue, and alpha values.
    static @NotNull ShadowColor
    shadowColor(int argb)
    Create a new shadow color from the ARGB value packed in an int.
    static @NotNull ShadowColor
    shadowColor(@NotNull ARGBLike argb)
    Create a shadow color from an existing ARGB colour.
    static @NotNull ShadowColor
    shadowColor(@NotNull RGBLike rgb, @org.jetbrains.annotations.Range(from=0L, to=255L) int alpha)
    Create a shadow color from an existing colour plus an alpha value.
    default void
    styleApply(@NotNull Style.Builder style)
    Applies to style.
    int
    The int-packed ARGB value of this shadow colour.

    Methods inherited from interface net.kyori.adventure.util.RGBLike

    asHSV

    Methods inherited from interface net.kyori.adventure.text.format.StyleBuilderApplicable

    componentBuilderApply
  • Method Details

    • lerp

      @NotNull static @NotNull ShadowColor lerp(float t, @NotNull @NotNull ARGBLike a, @NotNull @NotNull 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

      @NotNull static @NotNull 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) @NotNull static @NotNull 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) @NotNull static @NotNull ShadowColor shadowColor(@org.jetbrains.annotations.Range(from=0L, to=255L) int red, @org.jetbrains.annotations.Range(from=0L, to=255L) int green, @org.jetbrains.annotations.Range(from=0L, to=255L) int blue, @org.jetbrains.annotations.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) @NotNull static @NotNull ShadowColor shadowColor(@NotNull @NotNull RGBLike rgb, @org.jetbrains.annotations.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

      @NotNull static @NotNull ShadowColor shadowColor(@NotNull @NotNull 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) @Nullable static @Nullable ShadowColor fromHexString(@Pattern("#[0-9a-fA-F]{8}") @NotNull @NotNull 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

      @NotNull default @NotNull 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 @org.jetbrains.annotations.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 @org.jetbrains.annotations.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 @org.jetbrains.annotations.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 @org.jetbrains.annotations.Range(from=0L, to=255L) int alpha()
      Get the alpha component of the shadow colour.
      Specified by:
      alpha in interface ARGBLike
      Returns:
      the blue 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(@NotNull Style.Builder style)
      Description copied from interface: StyleBuilderApplicable
      Applies to style.
      Specified by:
      styleApply in interface StyleBuilderApplicable
      Parameters:
      style - the style builder