Package VASSAL.tools

Class QuickColors

java.lang.Object
VASSAL.tools.QuickColors

public class QuickColors extends Object
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 Details

  • 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

      public static int getQuickColor(String s)
      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

      public static int getQuickColor(String s, String prefix)
      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-prefix
      prefix - 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

      public static String stripQuickColorTag(String s)
      Strips the Quick Color tag from a string if any, readying it for display
      Parameters:
      s - String to strip Quick Color tag from
      Returns:
      the string minus the Quick Color tag, if one was present
    • stripQuickColorTag

      public static String stripQuickColorTag(String s, String prefix)
      Strips the Quick Color tag from a string if any, readying it for display
      Parameters:
      s - String to strip Quick Color tag from
      prefix - 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

      public static String getQuickColorHTMLStyle(String s)
      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 checked
      Returns:
      CSS class name to be used to display it
    • getQuickColorHTMLStyle

      public 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)
      Parameters:
      s - String to be checked
      prefix - 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