Class Color

java.lang.Object
com.marcusslover.plus.lib.color.Color

public class Color extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Color(float hue, float saturation, float brightness)
    Color(int rgb)
     
    Color(int red, int green, int blue)
     
    Color(Color javaColor)
     
    Color(@NotNull String hex)
     
    Color(net.kyori.adventure.text.format.TextColor adventureColor)
     
    Color(org.bukkit.Color bukkitColor)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull net.kyori.adventure.text.format.TextColor
    You will need to use Component.text(String).color(color.adventure()) and then serialize it LegacyComponentSerializer.legacySection()
    int
     
    int
     
    @NotNull Color
    brighter(double value)
    Creates a brighter color.
    org.bukkit.Color
     
    @NotNull Color
    darker(double value)
    Creates a darker color.
    int
     
    @NotNull String
    hex()
     
     
    @NotNull String
    A hacky way of pre-converting the color into a bukkit translatable color.
    static @NotNull Color
    of(float hue, float saturation, float brightness)
     
    static @NotNull Color
    of(int rgb)
     
    static @NotNull Color
    of(int red, int green, int blue)
     
    static @NotNull Color
    of(Color javaColor)
     
    static @NotNull Color
    of(@NotNull String hex)
     
    static @NotNull Color
    of(@NotNull net.kyori.adventure.text.format.TextColor adventureColor)
     
    static @NotNull Color
    of(org.bukkit.Color bukkitColor)
     
    @NotNull String
     
    int
    red()
     
    int
    rgb()
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Color

      public Color(@NotNull Color javaColor)
    • Color

      public Color(@NotNull org.bukkit.Color bukkitColor)
    • Color

      public Color(@NotNull @NotNull String hex)
    • Color

      public Color(int rgb)
    • Color

      public Color(int red, int green, int blue)
    • Color

      public Color(float hue, float saturation, float brightness)
    • Color

      public Color(net.kyori.adventure.text.format.TextColor adventureColor)
  • Method Details

    • of

      @NotNull public static @NotNull Color of(@NotNull Color javaColor)
    • of

      @NotNull public static @NotNull Color of(@NotNull org.bukkit.Color bukkitColor)
    • of

      @NotNull public static @NotNull Color of(@NotNull @NotNull net.kyori.adventure.text.format.TextColor adventureColor)
    • of

      @NotNull public static @NotNull Color of(@NotNull @NotNull String hex)
    • of

      @NotNull public static @NotNull Color of(int red, int green, int blue)
    • of

      @NotNull public static @NotNull Color of(float hue, float saturation, float brightness)
    • of

      @NotNull public static @NotNull Color of(int rgb)
    • rgb

      public int rgb()
    • red

      public int red()
    • green

      public int green()
    • blue

      public int blue()
    • alpha

      public int alpha()
    • hex

      @NotNull public @NotNull String hex()
      Returns:
      the hex value of the color #RRGGBB
    • plus

      @NotNull public @NotNull String plus()
      Returns:
      The hex color as a format plus recognizes
    • adventure

      @NotNull public @NotNull net.kyori.adventure.text.format.TextColor adventure()
      You will need to use Component.text(String).color(color.adventure()) and then serialize it LegacyComponentSerializer.legacySection()
      Returns:
      The Adventure API TextColor
    • bukkit

      @NotNull public org.bukkit.Color bukkit()
      Returns:
      The Bukkit API Color
    • java

      @NotNull public Color java()
      Returns:
      The Java AWT Color
    • legacy

      @NotNull public @NotNull String legacy()
      A hacky way of pre-converting the color into a bukkit translatable color. Note that this pretty much only works with CommandSender.sendMessage(String)
      Returns:
      the converted color as a String
    • darker

      @NotNull public @NotNull Color darker(double value)
      Creates a darker color. Take in mind, this function does not change values of the original color instance. Instead, it creates a completely new instance of color for you.
      Parameters:
      value - Darkness multiplier, value between 0.0 and 1.0.
      Returns:
      New, darker color.
    • brighter

      @NotNull public @NotNull Color brighter(double value)
      Creates a brighter color. Take in mind, this function does not change values of the original color instance. Instead, it creates a completely new instance of color for you.
      Parameters:
      value - Brightness multiplier, value between 0.0 and 1.0.
      Returns:
      New, brighter color.
    • toString

      public String toString()
      Overrides:
      toString in class Object