Package net.kyori.adventure.text.format
Interface ShadowColor
- All Superinterfaces:
ARGBLike
,ComponentBuilderApplicable
,RGBLike
,StyleBuilderApplicable
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 TypeMethodDescriptiondefault @org.jetbrains.annotations.Range(from=0L, to=255L) int
alpha()
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
blue()
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
green()
Get the green component of the shadow colour.static @NotNull ShadowColor
Linearly interpolates betweena
andb
byt
.static @NotNull ShadowColor
none()
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 tostyle
.int
value()
The int-packed ARGB value of this shadow colour.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 betweena
andb
byt
.This returns a color blended between color
a
, att=0.0
, and colorb
, att=1.0
.- Parameters:
t
- the interpolation value, between0.0
and1.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
andb
- Since:
- 4.18.0
-
none
Return a shadow color that will disable the shadow on a component.- Returns:
- a disabling shadow color
- Since:
- 4.18.0
-
shadowColor
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 valuegreen
- the green valueblue
- the blue valuealpha
- 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 coloralpha
- the alpha- Returns:
- a shadow colour
- Since:
- 4.18.0
-
shadowColor
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
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. -
green
default @org.jetbrains.annotations.Range(from=0L, to=255L) int green()Get the green component of the shadow colour. -
blue
default @org.jetbrains.annotations.Range(from=0L, to=255L) int blue()Get the blue component of the shadow colour. -
alpha
default @org.jetbrains.annotations.Range(from=0L, to=255L) int alpha()Get the alpha component of the shadow colour. -
value
int value()The int-packed ARGB value of this shadow colour.- Returns:
- the shadow colour value
- Since:
- 4.18.0
-
styleApply
Description copied from interface:StyleBuilderApplicable
Applies tostyle
.- Specified by:
styleApply
in interfaceStyleBuilderApplicable
- Parameters:
style
- the style builder
-