程序包 org.bukkit

类 Color

java.lang.Object
org.bukkit.Color
所有已实现的接口:
ConfigurationSerializable

public final class Color extends Object implements ConfigurationSerializable
这是一个调色板的容器。该类是不可更改的; 使用set方法可以返回一个新的自定义颜色。 这里颜色名字的列表为 HTML4 标准色, 但是随时可能更改
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final Color
    浅绿,或(R,G,B) 表示为 0x00,0xFF,0xFF)
    static final Color
    黑色,或(R,G,B) 表示为 0x00,0x00,0x00)
    static final Color
    蓝色,或(R,G,B) 表示为 0x00,0x00,0xFF)
    static final Color
    樱红色,或(R,G,B) 表示为 0xFF,0x00,0xFF)
    static final Color
    灰色,或(R,G,B) 表示为 0x80,0x80,0x80)
    static final Color
    绿色,或(R,G,B) 表示为 0x00,0x80,0x00)
    static final Color
    黄绿色,或(R,G,B) 表示为 0x00,0xFF,0x00)
    static final Color
    栗色,或(R,G,B) 表示为 0x80,0x00,0x00)
    static final Color
    海军色,或(R,G,B) 表示为 0x00,0x00,0x80)
    static final Color
    橄榄色,或(R,G,B) 表示为 0x80,0x80,0x00)
    static final Color
    橙色,或(R,G,B) 表示为 0xFF,0xA5,0x00)
    static final Color
    紫色,或(R,G,B) 表示为 0x80,0x00,0x80)
    static final Color
    红色,或(R,G,B) 表示为 0xFF,0x00,0x00)
    static final Color
    银色,或(R,G,B) 表示为 0xC0,0xC0,0xC0)
    static final Color
    蓝绿色,或(R,G,B) 表示为 0x00,0x80,0x80)
    static final Color
    白色,或(R,G,B) 表示为 0xFF,0xFF,0xFF)
    static final Color
    黄色,或(R,G,B) 表示为 0xFF,0xFF,0x00)
  • 方法概要

    修饰符和类型
    方法
    说明
    int
     
    int
     
    static Color
     
    boolean
     
    static Color
    fromBGR(int bgr)
    Creates a new color object from an integer that contains the blue, green, and red bytes in the lowest order 24 bits.
    static Color
    fromBGR(int blue, int green, int red)
    用 蓝,绿,红 创建一个新的颜色对象
    static Color
    fromRGB(int rgb)
    从一个RGB整数中创建一个新的颜色对象,该对象包含最低24bits
    static Color
    fromRGB(int red, int green, int blue)
    用 红,绿,蓝 创建一个新的颜色对象
    int
    Gets the blue component
    int
    Gets the green component
    int
    Gets the red component
    int
     
    mixColors(Color... colors)
    Creates a new color with its RGB components changed as if it was dyed with the colors passed in, replicating vanilla workbench dyeing
    mixDyes(DyeColor... colors)
    Creates a new color with its RGB components changed as if it was dyed with the colors passed in, replicating vanilla workbench dyeing
    Creates a Map representation of this class.
    setBlue(int blue)
    Creates a new Color object with specified component
    setGreen(int green)
    Creates a new Color object with specified component
    setRed(int red)
    Creates a new Color object with specified component
     

    从类继承的方法 java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 字段详细资料

    • WHITE

      public static final Color WHITE
      白色,或(R,G,B) 表示为 0xFF,0xFF,0xFF)
    • SILVER

      public static final Color SILVER
      银色,或(R,G,B) 表示为 0xC0,0xC0,0xC0)
    • GRAY

      public static final Color GRAY
      灰色,或(R,G,B) 表示为 0x80,0x80,0x80)
    • BLACK

      public static final Color BLACK
      黑色,或(R,G,B) 表示为 0x00,0x00,0x00)
    • RED

      public static final Color RED
      红色,或(R,G,B) 表示为 0xFF,0x00,0x00)
    • MAROON

      public static final Color MAROON
      栗色,或(R,G,B) 表示为 0x80,0x00,0x00)
    • YELLOW

      public static final Color YELLOW
      黄色,或(R,G,B) 表示为 0xFF,0xFF,0x00)
    • OLIVE

      public static final Color OLIVE
      橄榄色,或(R,G,B) 表示为 0x80,0x80,0x00)
    • LIME

      public static final Color LIME
      黄绿色,或(R,G,B) 表示为 0x00,0xFF,0x00)
    • GREEN

      public static final Color GREEN
      绿色,或(R,G,B) 表示为 0x00,0x80,0x00)
    • AQUA

      public static final Color AQUA
      浅绿,或(R,G,B) 表示为 0x00,0xFF,0xFF)
    • TEAL

      public static final Color TEAL
      蓝绿色,或(R,G,B) 表示为 0x00,0x80,0x80)
    • BLUE

      public static final Color BLUE
      蓝色,或(R,G,B) 表示为 0x00,0x00,0xFF)
    • FUCHSIA

      public static final Color FUCHSIA
      樱红色,或(R,G,B) 表示为 0xFF,0x00,0xFF)
    • PURPLE

      public static final Color PURPLE
      紫色,或(R,G,B) 表示为 0x80,0x00,0x80)
    • ORANGE

      public static final Color ORANGE
      橙色,或(R,G,B) 表示为 0xFF,0xA5,0x00)
  • 方法详细资料

    • fromRGB

      public static Color fromRGB(int red, int green, int blue) throws IllegalArgumentException
      用 红,绿,蓝 创建一个新的颜色对象
      参数:
      red - integer 取值0-255
      green - integer 取值 0-255
      blue - integer 取值 0-255
      返回:
      一个RGB颜色对象
      抛出:
      IllegalArgumentException - if any value is strictly >255 or <0
    • fromBGR

      public static Color fromBGR(int blue, int green, int red) throws IllegalArgumentException
      用 蓝,绿,红 创建一个新的颜色对象
      参数:
      blue - integer 取值 0-255
      green - integer 取值 0-255
      red - integer 取值 0-255
      返回:
      a new Color object for the red, green, blue
      抛出:
      IllegalArgumentException - 任何一个参数超出 >255 or <0 范围
    • fromRGB

      public static Color fromRGB(int rgb) throws IllegalArgumentException
      从一个RGB整数中创建一个新的颜色对象,该对象包含最低24bits
      参数:
      rgb - the integer storing the red, green, and blue values
      返回:
      a new color object for specified values
      抛出:
      IllegalArgumentException - if any data is in the highest order 8 bits
    • fromBGR

      public static Color fromBGR(int bgr) throws IllegalArgumentException
      Creates a new color object from an integer that contains the blue, green, and red bytes in the lowest order 24 bits.
      参数:
      bgr - the integer storing the blue, green, and red values
      返回:
      a new color object for specified values
      抛出:
      IllegalArgumentException - if any data is in the highest order 8 bits
    • getRed

      public int getRed()
      Gets the red component
      返回:
      red component, from 0 to 255
    • setRed

      public Color setRed(int red)
      Creates a new Color object with specified component
      参数:
      red - the red component, from 0 to 255
      返回:
      a new color object with the red component
    • getGreen

      public int getGreen()
      Gets the green component
      返回:
      green component, from 0 to 255
    • setGreen

      public Color setGreen(int green)
      Creates a new Color object with specified component
      参数:
      green - the red component, from 0 to 255
      返回:
      a new color object with the red component
    • getBlue

      public int getBlue()
      Gets the blue component
      返回:
      blue component, from 0 to 255
    • setBlue

      public Color setBlue(int blue)
      Creates a new Color object with specified component
      参数:
      blue - the red component, from 0 to 255
      返回:
      a new color object with the red component
    • asRGB

      public int asRGB()
      返回:
      An integer representation of this color, as 0xRRGGBB
    • asBGR

      public int asBGR()
      返回:
      An integer representation of this color, as 0xBBGGRR
    • mixDyes

      public Color mixDyes(DyeColor... colors)
      Creates a new color with its RGB components changed as if it was dyed with the colors passed in, replicating vanilla workbench dyeing
      参数:
      colors - The DyeColors to dye with
      返回:
      A new color with the changed rgb components
    • mixColors

      public Color mixColors(Color... colors)
      Creates a new color with its RGB components changed as if it was dyed with the colors passed in, replicating vanilla workbench dyeing
      参数:
      colors - The colors to dye with
      返回:
      A new color with the changed rgb components
    • equals

      public boolean equals(Object o)
      覆盖:
      equals 在类中 Object
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object
    • serialize

      public Map<String,Object> serialize()
      从接口复制的说明: ConfigurationSerializable
      Creates a Map representation of this class.

      This class must provide a method to restore this class, as defined in the ConfigurationSerializable interface javadocs.

      指定者:
      serialize 在接口中 ConfigurationSerializable
      返回:
      Map containing the current state of this class
    • deserialize

      public static Color deserialize(Map<String,Object> map)
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object