PircBot Java IRC Bot

## org.jibble.pircbot
Class Colors

    java.lang.Object
      org.jibble.pircbot.Colors

public class Colors
extends Object

The Colors class provides several static fields and methods that you may find useful when writing an IRC Bot.

This class contains constants that are useful for formatting lines sent to IRC servers. These constants allow you to apply various formatting to the lines, such as colours, boldness, underlining and reverse text.

The class contains static methods to remove colours and formatting from lines of IRC text.

Here are some examples of how to use the contants from within a class that extends PircBot and imports org.jibble.pircbot.*;

     sendMessage("#cs", Colors.BOLD + "A bold hello!");
         A bold hello!
     sendMessage("#cs", Colors.RED + "Red" + Colors.NORMAL + " text");
         Red text
     sendMessage("#cs", Colors.BOLD + Colors.RED + "Bold and red");
         Bold and red

Please note that some IRC channels may be configured to reject any messages that use colours. Also note that older IRC clients may be unable to correctly display lines that contain colours and other control characters.

Note that this class name has been spelt in the American style in order to remain consistent with the rest of the Java API.

Since:
  0.9.12
Version:
  1.5.0 (Build time: Mon Dec 14 20:07:17 2009)
Author:
  Paul James Mutton, http://www.jibble.org/

Field Summary
`static String` `BLACK` Black coloured text.
`static String` `BLUE` Blue coloured text.
`static String` `BOLD` Bold text.
`static String` `BROWN` Brown coloured text.
`static String` `CYAN` Cyan coloured text.
`static String` `DARK_BLUE` Dark blue coloured text.
`static String` `DARK_GRAY` Dark gray coloured text.
`static String` `DARK_GREEN` Dark green coloured text.
`static String` `GREEN` Green coloured text.
`static String` `LIGHT_GRAY` Light gray coloured text.
`static String` `MAGENTA` Magenta coloured text.
`static String` `NORMAL` Removes all previously applied color and formatting attributes.
`static String` `OLIVE` Olive coloured text.
`static String` `PURPLE` Purple coloured text.
`static String` `RED` Red coloured text.
`static String` `REVERSE` Reversed text (may be rendered as italic text in some clients).
`static String` `TEAL` Teal coloured text.
`static String` `UNDERLINE` Underlined text.
`static String` `WHITE` White coloured text.
`static String` `YELLOW` Yellow coloured text.

Method Summary
`static String` `removeColors(String line)` Removes all colours from a line of IRC text.
`static String` `removeFormatting(String line)` Remove formatting from a line of IRC text.
`static String` `removeFormattingAndColors(String line)` Removes all formatting and colours from a line of IRC text.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NORMAL

    public static final String NORMAL

  Removes all previously applied color and formatting attributes.

  See Also:
    Constant Field Values

### BOLD

    public static final String BOLD

  Bold text.

  See Also:
    Constant Field Values

### UNDERLINE

    public static final String UNDERLINE

  Underlined text.

  See Also:
    Constant Field Values

### REVERSE

    public static final String REVERSE

  Reversed text (may be rendered as italic text in some clients).

  See Also:
    Constant Field Values

### WHITE

    public static final String WHITE

  White coloured text.

  See Also:
    Constant Field Values

### BLACK

    public static final String BLACK

  Black coloured text.

  See Also:
    Constant Field Values

### DARK_BLUE

    public static final String DARK_BLUE

  Dark blue coloured text.

  See Also:
    Constant Field Values

### DARK_GREEN

    public static final String DARK_GREEN

  Dark green coloured text.

  See Also:
    Constant Field Values

### RED

    public static final String RED

  Red coloured text.

  See Also:
    Constant Field Values

### BROWN

    public static final String BROWN

  Brown coloured text.

  See Also:
    Constant Field Values

### PURPLE

    public static final String PURPLE

  Purple coloured text.

  See Also:
    Constant Field Values

### OLIVE

    public static final String OLIVE

  Olive coloured text.

  See Also:
    Constant Field Values

### YELLOW

    public static final String YELLOW

  Yellow coloured text.

  See Also:
    Constant Field Values

### GREEN

    public static final String GREEN

  Green coloured text.

  See Also:
    Constant Field Values

### TEAL

    public static final String TEAL

  Teal coloured text.

  See Also:
    Constant Field Values

### CYAN

    public static final String CYAN

  Cyan coloured text.

  See Also:
    Constant Field Values

### BLUE

    public static final String BLUE

  Blue coloured text.

  See Also:
    Constant Field Values

### MAGENTA

    public static final String MAGENTA

  Magenta coloured text.

  See Also:
    Constant Field Values

### DARK_GRAY

    public static final String DARK_GRAY

  Dark gray coloured text.

  See Also:
    Constant Field Values

### LIGHT_GRAY

    public static final String LIGHT_GRAY

  Light gray coloured text.

  See Also:
    Constant Field Values

Method Detail

### removeColors

    public static String removeColors(String line)

  Removes all colours from a line of IRC text.

  Parameters:
    `line` - the input text.
  Returns:
    the same text, but with all colours removed.
  Since:
    PircBot 1.2.0

### removeFormatting

    public static String removeFormatting(String line)

  Remove formatting from a line of IRC text.

  Parameters:
    `line` - the input text.
  Returns:
    the same text, but without any bold, underlining, reverse, etc.
  Since:
    PircBot 1.2.0

### removeFormattingAndColors

    public static String removeFormattingAndColors(String line)

  Removes all formatting and colours from a line of IRC text.

  Parameters:
    `line` - the input text.
  Returns:
    the same text, but without formatting and colour characters.
  Since:
    PircBot 1.2.0

PircBot Java IRC Bot