Enum Class Ansi4BitColor

java.lang.Object
java.lang.Enum<Ansi4BitColor>
org.miaixz.bus.core.lang.ansi.Ansi4BitColor
All Implemented Interfaces:
Serializable, Comparable<Ansi4BitColor>, Constable, AnsiElement

public enum Ansi4BitColor extends Enum<Ansi4BitColor> implements AnsiElement
ANSI标准颜色
Since:
Java 17+
Author:
Kimi Liu
  • Enum Constant Details

  • Method Details

    • values

      public static Ansi4BitColor[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Ansi4BitColor valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • of

      public static Ansi4BitColor of(int code)
      根据code查找对应的AnsiColor
      Parameters:
      code - AnsiEncoder 4bit 颜色代码
      Returns:
      Color4Bit
    • getCode

      public int getCode()
      获取ANSI颜色代码(前景色)
      Specified by:
      getCode in interface AnsiElement
      Returns:
      颜色代码
    • getCode

      public int getCode(boolean isBackground)
      获取ANSI颜色代码
      Parameters:
      isBackground - 是否背景色
      Returns:
      颜色代码
    • asBackground

      public Ansi4BitColor asBackground()
      获取前景色对应的背景色
      Returns:
      背景色
    • toString

      public String toString()
      Specified by:
      toString in interface AnsiElement
      Overrides:
      toString in class Enum<Ansi4BitColor>
      Returns:
      ANSI转义编码