Class QuickColors
java.lang.Object
VASSAL.tools.QuickColors
Allows certain special characters at the beginning of a string to control a color styling, as an
easier shortcut than putting style="color:#00ffff;" tags in every message.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
getQuickColor
(char c) Checks if a character is a Quick Color codestatic int
Checks if the string begins with a Quick Color codestatic int
getQuickColor
(String s, String prefix) Checks if the string begins with a Quick Color code (possibly after a prefix)static String
Returns the proper CSS class name to be used to display the string, based on Quick Color (or lack thereof)static String
getQuickColorHTMLStyle
(String s, String prefix) Returns the proper CSS class name to be used to display the string, based on Quick Color (or lack thereof)static String
Strips the Quick Color tag from a string if any, readying it for displaystatic String
stripQuickColorTag
(String s, String prefix) Strips the Quick Color tag from a string if any, readying it for display
-
Field Details
-
QUICK_COLOR_CODES
- See Also:
-
QUICK_COLOR_NONE
public static final int QUICK_COLOR_NONE- See Also:
-
QUICK_COLOR_REGEX
-
-
Constructor Details
-
QuickColors
public QuickColors()
-
-
Method Details
-
getQuickColor
public static int getQuickColor(char c) Checks if a character is a Quick Color code- Parameters:
c
- Character to check if it's a Quick Color code- Returns:
- Index of Quick Color code, or -1 if none
-
getQuickColor
Checks if the string begins with a Quick Color code- Parameters:
s
- String to check first non-space character of- Returns:
- Index of Quick Color code, or -1 if none
-
getQuickColor
Checks if the string begins with a Quick Color code (possibly after a prefix)- Parameters:
s
- String to check first non-space-character-after-the-prefixprefix
- Prefix to ignore (e.g. "*" at the beginning of Game Messages sent to the Chatter)- Returns:
- Index of Quick Color code, or -1 if none
-
stripQuickColorTag
-
stripQuickColorTag
Strips the Quick Color tag from a string if any, readying it for display- Parameters:
s
- String to strip Quick Color tag fromprefix
- Prefix to ignore (e.g. "*" at the beginning of Game Messages sent to the Chatter)- Returns:
- the string minus the Quick Color tag, if one was present
-
getQuickColorHTMLStyle
-
getQuickColorHTMLStyle
Returns the proper CSS class name to be used to display the string, based on Quick Color (or lack thereof)- Parameters:
s
- String to be checkedprefix
- Prefix to ignore (e.g. "*" at the beginning of Game Messages sent to the Chatter)- Returns:
- CSS class name to be used to display it
-