Package com.alessiodp.core.common.utils
Enum Color
- java.lang.Object
-
- java.lang.Enum<Color>
-
- com.alessiodp.core.common.utils.Color
-
- All Implemented Interfaces:
Serializable,Comparable<Color>
public enum Color extends Enum<Color>
-
-
Field Summary
Fields Modifier and Type Field Description static charCOLOR_CHARstatic charHEX_CHAR
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringformatColorByName(String name)Format a color by getting it with its namestatic StringformatColorByNameOrText(String text)Format a color by getting it with its name or color codesstatic StringformatColorNamesByName(String name)Format a color name by getting it with its namestatic StringformatColorNamesByNameOrText(String text)Format a color name by getting it with its name or color codesstatic StringformatLastColors(String text)Format the latest colors of the textstatic StringformatNamesLastColors(String text)Format the latest colors names of the textstatic ColorgetByChar(char code)Get the color by its charstatic ColorgetByName(String name)Get the color by its namechargetChar()Get the char of the colorstatic Pair<Color,Color>getLastColors(String text)Get the latest colors text.booleanisFormat()Is the a format code instead of colorstatic StringstripColor(String input)Remove any color from the textStringtoString()StringtoStringSimple()Get the string value with the syntax & and the color codestatic StringtranslateAlternateColorCodes(char altColorChar, String textToTranslate)Translate the string with an alternative color charstatic StringtranslateAlternateColorCodes(String textToTranslate)Translate the string with & as color charstatic StringtranslateAndStripColor(String input)Translate with alternative & and remove any color from the textstatic StringtranslateHex(char altColorChar, String textToTranslate)Translate the string with an alternative color char followed by an hex color codestatic ColorvalueOf(String name)Returns the enum constant of this type with the specified name.static Color[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
BLACK
public static final Color BLACK
-
DARK_BLUE
public static final Color DARK_BLUE
-
DARK_GREEN
public static final Color DARK_GREEN
-
DARK_AQUA
public static final Color DARK_AQUA
-
DARK_RED
public static final Color DARK_RED
-
DARK_PURPLE
public static final Color DARK_PURPLE
-
GOLD
public static final Color GOLD
-
GRAY
public static final Color GRAY
-
DARK_GRAY
public static final Color DARK_GRAY
-
BLUE
public static final Color BLUE
-
GREEN
public static final Color GREEN
-
AQUA
public static final Color AQUA
-
RED
public static final Color RED
-
LIGHT_PURPLE
public static final Color LIGHT_PURPLE
-
YELLOW
public static final Color YELLOW
-
WHITE
public static final Color WHITE
-
MAGIC
public static final Color MAGIC
-
BOLD
public static final Color BOLD
-
STRIKETHROUGH
public static final Color STRIKETHROUGH
-
UNDERLINE
public static final Color UNDERLINE
-
ITALIC
public static final Color ITALIC
-
RESET
public static final Color RESET
-
HEX
public static final Color HEX
-
-
Field Detail
-
COLOR_CHAR
public static final char COLOR_CHAR
- See Also:
- Constant Field Values
-
HEX_CHAR
public static final char HEX_CHAR
- See Also:
- Constant Field Values
-
-
Method Detail
-
values
public static Color[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Color c : Color.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Color valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
-
getChar
public char getChar()
Get the char of the color- Returns:
- the char of the color
-
isFormat
public boolean isFormat()
Is the a format code instead of color- Returns:
- true if its a format code
-
toStringSimple
public String toStringSimple()
Get the string value with the syntax & and the color code- Returns:
- the string value simplified
-
getByName
public static Color getByName(String name)
Get the color by its name- Parameters:
name- the name of the color- Returns:
- the color found or null
-
getByChar
public static Color getByChar(char code)
Get the color by its char- Parameters:
code- the char of the color- Returns:
- the color found or null
-
stripColor
public static String stripColor(String input)
Remove any color from the text- Parameters:
input- the text with color codes- Returns:
- a new text without colors
-
translateAndStripColor
public static String translateAndStripColor(String input)
Translate with alternative & and remove any color from the text- Parameters:
input- the text with color codes- Returns:
- a new text without colors
-
translateAlternateColorCodes
public static String translateAlternateColorCodes(String textToTranslate)
Translate the string with & as color char- Parameters:
textToTranslate- the text to translate- Returns:
- the new text with translated colors
-
translateAlternateColorCodes
public static String translateAlternateColorCodes(char altColorChar, String textToTranslate)
Translate the string with an alternative color char- Parameters:
altColorChar- the alternative char to usetextToTranslate- the text to translate- Returns:
- the new text with translated colors
-
translateHex
public static String translateHex(char altColorChar, String textToTranslate)
Translate the string with an alternative color char followed by an hex color code- Parameters:
altColorChar- the alternative char to usetextToTranslate- the text to translate- Returns:
- the new text with translated colors
-
formatLastColors
public static String formatLastColors(String text)
Format the latest colors of the text- Parameters:
text- the text used to retrieve latest colors- Returns:
- colors found parsed
-
formatNamesLastColors
public static String formatNamesLastColors(String text)
Format the latest colors names of the text- Parameters:
text- the text used to retrieve latest colors- Returns:
- color names found
-
formatColorByName
public static String formatColorByName(String name)
Format a color by getting it with its name- Parameters:
name- the color name to format- Returns:
- the formatted value of the color or empty if doesn't exist
-
formatColorNamesByName
public static String formatColorNamesByName(String name)
Format a color name by getting it with its name- Parameters:
name- the color name to format- Returns:
- the original color name or empty if doesn't exist
-
formatColorByNameOrText
public static String formatColorByNameOrText(String text)
Format a color by getting it with its name or color codes- Parameters:
text- the color name or color codes to format- Returns:
- a string with parsed colors
-
formatColorNamesByNameOrText
public static String formatColorNamesByNameOrText(String text)
Format a color name by getting it with its name or color codes- Parameters:
text- the color name or color codes to format- Returns:
- a string with color names
-
-