Package org.bukkit

# Enum Class ChatColor

java.lang.Object
java.lang.Enum<ChatColor>
org.bukkit.ChatColor

All Implemented Interfaces:
  `Serializable`, `Comparable<ChatColor>`, `Constable`

public enum ChatColor extends Enum<ChatColor>
All supported color values for chat

## Nested Class Summary

## Nested classes/interfaces inherited from class java.lang.Enum

`Enum.EnumDesc<E extends Enum<E>>`

## Enum Constant Summary

Enum Constants
Enum Constant
Description
`AQUA`
Represents aqua
`BLACK`
Represents black
`BLUE`
Represents blue
`BOLD`
Makes the text bold.
`DARK_AQUA`
Represents dark blue (aqua)
`DARK_BLUE`
Represents dark blue
`DARK_GRAY`
Represents dark gray
`DARK_GREEN`
Represents dark green
`DARK_PURPLE`
Represents dark purple
`DARK_RED`
Represents dark red
`GOLD`
Represents gold
`GRAY`
Represents gray
`GREEN`
Represents green
`ITALIC`
Makes the text italic.
`LIGHT_PURPLE`
Represents light purple
`MAGIC`
Represents magical characters that change around randomly
`RED`
Represents red
`RESET`
Resets all previous chat colors or formats.
`STRIKETHROUGH`
Makes a line appear through the text.
`UNDERLINE`
Makes the text appear underlined.
`WHITE`
Represents white
`YELLOW`
Represents yellow

## Field Summary

Fields
Modifier and Type
Field
Description
`static final char`
`COLOR_CHAR`
The special character which prefixes all chat colour codes.

## Method Summary

Modifier and Type
Method
Description
`ChatColor`
`asBungee()`
`static @Nullable ChatColor`
`getByChar(char code)`
Gets the color represented by the specified color code
`static @Nullable ChatColor`
`getByChar(@NotNull String code)`
Gets the color represented by the specified color code
`char`
`getChar()`
Gets the char value associated with this color
`static @NotNull String`
`getLastColors(@NotNull String input)`
Gets the ChatColors used at the end of the given input string.
`boolean`
`isColor()`
Checks if this code is a color code as opposed to a format code.
`boolean`
`isFormat()`
Checks if this code is a format code as opposed to a color code.
`static @Nullable String`
`stripColor(@Nullable String input)`
Strips the given message of all color codes
`@NotNull String`
`toString()`
`static @NotNull String`
`translateAlternateColorCodes(char altColorChar, @NotNull String textToTranslate)`
Translates a string using an alternate color code character into a string that uses the internal ChatColor.COLOR_CODE color code character.
`static ChatColor`
`valueOf(String name)`
Returns the enum constant of this class with the specified name.
`static ChatColor[]`
`values()`
Returns an array containing the constants of this enum class, in the order they are declared.

### Methods inherited from class java.lang.Enum

`clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

## Enum Constant Details

### BLACK

public static final ChatColor BLACK
Represents black

### DARK_BLUE

public static final ChatColor DARK_BLUE
Represents dark blue

### DARK_GREEN

public static final ChatColor DARK_GREEN
Represents dark green

### DARK_AQUA

public static final ChatColor DARK_AQUA
Represents dark blue (aqua)

### DARK_RED

public static final ChatColor DARK_RED
Represents dark red

### DARK_PURPLE

public static final ChatColor DARK_PURPLE
Represents dark purple

### GOLD

public static final ChatColor GOLD
Represents gold

### GRAY

public static final ChatColor GRAY
Represents gray

### DARK_GRAY

public static final ChatColor DARK_GRAY
Represents dark gray

### BLUE

public static final ChatColor BLUE
Represents blue

### GREEN

public static final ChatColor GREEN
Represents green

### AQUA

public static final ChatColor AQUA
Represents aqua

### RED

public static final ChatColor RED
Represents red

### LIGHT_PURPLE

public static final ChatColor LIGHT_PURPLE
Represents light purple

### YELLOW

public static final ChatColor YELLOW
Represents yellow

### WHITE

public static final ChatColor WHITE
Represents white

### MAGIC

public static final ChatColor MAGIC
Represents magical characters that change around randomly

### BOLD

public static final ChatColor BOLD
Makes the text bold.

### STRIKETHROUGH

public static final ChatColor STRIKETHROUGH
Makes a line appear through the text.

### UNDERLINE

public static final ChatColor UNDERLINE
Makes the text appear underlined.

### ITALIC

public static final ChatColor ITALIC
Makes the text italic.

### RESET

public static final ChatColor RESET
Resets all previous chat colors or formats.

## Field Details

### COLOR_CHAR

public static final char COLOR_CHAR
The special character which prefixes all chat colour codes. Use this if you need to dynamically convert colour codes from your custom format.

See Also:
  - Constant Field Values

## Method Details

### values

public static ChatColor[] 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 ChatColor 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

### asBungee

@NotNull public ChatColor asBungee()

### getChar

public char getChar()
Gets the char value associated with this color

Returns:
  A char value of this color code

### toString

@NotNull public @NotNull String toString()

Overrides:
  `toString` in class `Enum<ChatColor>`

### isFormat

public boolean isFormat()
Checks if this code is a format code as opposed to a color code.

Returns:
  whether this ChatColor is a format code

### isColor

public boolean isColor()
Checks if this code is a color code as opposed to a format code.

Returns:
  whether this ChatColor is a color code

### getByChar

@Nullable public static @Nullable ChatColor getByChar(char code)
Gets the color represented by the specified color code

Parameters:
  `code` - Code to check
Returns:
  Associative `ChatColor` with the given code, or null if it doesn't exist

### getByChar

@Nullable public static @Nullable ChatColor getByChar(@NotNull @NotNull String code)
Gets the color represented by the specified color code

Parameters:
  `code` - Code to check
Returns:
  Associative `ChatColor` with the given code, or null if it doesn't exist

### stripColor

@Contract("!null -> !null; null -> null") @Nullable public static @Nullable String stripColor(@Nullable @Nullable String input)
Strips the given message of all color codes

Parameters:
  `input` - String to strip of color
Returns:
  A copy of the input string, without any coloring

### translateAlternateColorCodes

@NotNull public static @NotNull String translateAlternateColorCodes(char altColorChar, @NotNull @NotNull String textToTranslate)
Translates a string using an alternate color code character into a string that uses the internal ChatColor.COLOR_CODE color code character. The alternate color code character will only be replaced if it is immediately followed by 0-9, A-F, a-f, K-O, k-o, R or r.

Parameters:
  `altColorChar` - The alternate color code character to replace. Ex: &
  `textToTranslate` - Text containing the alternate color code character.
Returns:
  Text containing the ChatColor.COLOR_CODE color code character.

### getLastColors

@NotNull public static @NotNull String getLastColors(@NotNull @NotNull String input)
Gets the ChatColors used at the end of the given input string.

Parameters:
  `input` - Input string to retrieve the colors from.
Returns:
  Any remaining ChatColors to pass onto the next line.