Package org.miaixz.bus.core.lang.ansi
Enum Class Ansi4BitColor
- All Implemented Interfaces:
Serializable,Comparable<Ansi4BitColor>,Constable,AnsiElement
ANSI标准颜色
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription黑色蓝青默认背景色绿品红红黄黑蓝亮黑亮蓝亮青亮绿亮品红亮红亮白亮黄青默认前景色绿品红红白黄 -
Method Summary
Modifier and TypeMethodDescription获取前景色对应的背景色intgetCode()获取ANSI颜色代码(前景色)intgetCode(boolean isBackground) 获取ANSI颜色代码static Ansi4BitColorof(int code) 根据code查找对应的AnsiColortoString()static Ansi4BitColorReturns the enum constant of this class with the specified name.static Ansi4BitColor[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DEFAULT
默认前景色 -
BLACK
黑 -
RED
红 -
GREEN
绿 -
YELLOW
黄 -
BLUE
蓝 -
MAGENTA
品红 -
CYAN
青 -
WHITE
白 -
BRIGHT_BLACK
亮黑 -
BRIGHT_RED
亮红 -
BRIGHT_GREEN
亮绿 -
BRIGHT_YELLOW
亮黄 -
BRIGHT_BLUE
亮蓝 -
BRIGHT_MAGENTA
亮品红 -
BRIGHT_CYAN
亮青 -
BRIGHT_WHITE
亮白 -
BG_DEFAULT
默认背景色 -
BG_BLACK
黑色 -
BG_RED
红 -
BG_GREEN
绿 -
BG_YELLOW
黄 -
BG_BLUE
蓝 -
BG_MAGENTA
品红 -
BG_CYAN
青
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
of
根据code查找对应的AnsiColor- Parameters:
code- AnsiEncoder 4bit 颜色代码- Returns:
- Color4Bit
-
getCode
public int getCode()获取ANSI颜色代码(前景色)- Specified by:
getCodein interfaceAnsiElement- Returns:
- 颜色代码
-
getCode
public int getCode(boolean isBackground) 获取ANSI颜色代码- Parameters:
isBackground- 是否背景色- Returns:
- 颜色代码
-
asBackground
获取前景色对应的背景色- Returns:
- 背景色
-
toString
- Specified by:
toStringin interfaceAnsiElement- Overrides:
toStringin classEnum<Ansi4BitColor>- Returns:
- ANSI转义编码
-