Interface TextColor

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default @NotNull java.lang.String asHexString()
      Gets the color, as a hex string.
      default @org.jetbrains.annotations.Range(from=0L, to=255L) int blue()
      Get the blue component of the text colour.
      static @NotNull TextColor color​(@org.jetbrains.annotations.Range(from=0L, to=255L) int r, @org.jetbrains.annotations.Range(from=0L, to=255L) int g, @org.jetbrains.annotations.Range(from=0L, to=255L) int b)
      Create a new text colour with the red, green, and blue components individually.
      static @NotNull TextColor color​(float r, float g, float b)
      Create a new color with the individual components as floats.
      static @NotNull TextColor color​(int value)
      Creates a new text colour.
      static @NotNull TextColor color​(@NotNull HSVLike hsv)
      Creates a new text color, converting the provided HSVLike to the RGB color space.
      static @NotNull TextColor color​(@NotNull RGBLike rgb)
      Creates a new text colour.
      default int compareTo​(TextColor that)  
      default @NotNull java.util.stream.Stream<? extends net.kyori.examination.ExaminableProperty> examinableProperties()  
      static @Nullable TextColor fromCSSHexString​(@NotNull java.lang.String string)
      Create a color from a CSS hex string (#rrggbb or #rgb).
      static @Nullable TextColor fromHexString​(@NotNull java.lang.String string)
      Create a new color from a hex string.
      default @org.jetbrains.annotations.Range(from=0L, to=255L) int green()
      Get the green component of the text colour.
      static @NotNull TextColor lerp​(float t, @NotNull RGBLike a, @NotNull RGBLike b)
      Linearly interpolates between a and b by t.
      default @org.jetbrains.annotations.Range(from=0L, to=255L) int red()
      Get the red component of the text colour.
      default void styleApply​(@NotNull Style.Builder style)
      Applies to style.
      int value()
      The color, as an RGB value packed into an int.
      • Methods inherited from interface net.kyori.examination.Examinable

        examinableName, examine
      • Methods inherited from interface net.kyori.adventure.util.RGBLike

        asHSV
    • Method Detail

      • color

        @NotNull
        static @NotNull TextColor color​(int value)
        Creates a new text colour.
        Parameters:
        value - the rgb value
        Returns:
        a new text colour
        Since:
        4.0.0
      • color

        @NotNull
        static @NotNull TextColor color​(@NotNull
                                        @NotNull RGBLike rgb)
        Creates a new text colour.
        Parameters:
        rgb - the rgb value
        Returns:
        a new text colour
        Since:
        4.0.0
      • color

        @NotNull
        static @NotNull TextColor color​(@org.jetbrains.annotations.Range(from=0L, to=255L) int r,
                                        @org.jetbrains.annotations.Range(from=0L, to=255L) int g,
                                        @org.jetbrains.annotations.Range(from=0L, to=255L) int b)
        Create a new text colour with the red, green, and blue components individually.
        Parameters:
        r - red, as a value from 0 to 255
        g - green, as a value from 0 to 255
        b - blue, as a value from 0 to 255
        Returns:
        a new text colour
        Since:
        4.0.0
      • color

        @NotNull
        static @NotNull TextColor color​(float r,
                                        float g,
                                        float b)
        Create a new color with the individual components as floats.
        Parameters:
        r - red, from [0, 1]
        g - green, within [0, 1]
        b - blue, within [0, 1]
        Returns:
        a new text colour
        Since:
        4.0.0
      • fromHexString

        @Nullable
        static @Nullable TextColor fromHexString​(@NotNull
                                                 @NotNull java.lang.String string)
        Create a new color from a hex string.
        Parameters:
        string - the hex string
        Returns:
        a new text colour
        Since:
        4.0.0
      • fromCSSHexString

        @Nullable
        static @Nullable TextColor fromCSSHexString​(@NotNull
                                                    @NotNull java.lang.String string)
        Create a color from a CSS hex string (#rrggbb or #rgb).
        Parameters:
        string - the hex string
        Returns:
        a new text colour
        Since:
        4.0.0
      • value

        int value()
        The color, as an RGB value packed into an int.
        Returns:
        the value
        Since:
        4.0.0
      • asHexString

        @NotNull
        default @NotNull java.lang.String asHexString()
        Gets the color, as a hex string.
        Returns:
        a hex string
        Since:
        4.0.0
      • red

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

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

        default @org.jetbrains.annotations.Range(from=0L, to=255L) int blue()
        Get the blue component of the text colour.
        Specified by:
        blue in interface RGBLike
        Returns:
        the blue component, in the range [0x0, 0xff]
        Since:
        4.0.0
      • lerp

        @NotNull
        static @NotNull TextColor lerp​(float t,
                                       @NotNull
                                       @NotNull RGBLike a,
                                       @NotNull
                                       @NotNull RGBLike 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.8.0
      • compareTo

        default int compareTo​(TextColor that)
        Specified by:
        compareTo in interface java.lang.Comparable<TextColor>
      • examinableProperties

        @NotNull
        default @NotNull java.util.stream.Stream<? extends net.kyori.examination.ExaminableProperty> examinableProperties()
        Specified by:
        examinableProperties in interface net.kyori.examination.Examinable