Josh
Native console access wrapper for Java

com.yifanlu.Josh
Class ConsoleColor

java.lang.Object
  extended by com.yifanlu.Josh.ConsoleAttribute
      extended by com.yifanlu.Josh.ConsoleColor

public class ConsoleColor
extends ConsoleAttribute

Stores the color attributes of console output. This is just ConsoleAttribute with color constants and methods.

Since:
0.1
Version:
1.3, 05/29/10
Author:
Yifan Lu
See Also:
JoshOutput

Field Summary
static int BACKGROUND_BLUE
          Background color constant.
static int BACKGROUND_GREEN
          Background color constant.
static int BACKGROUND_INTENSITY
          Background color constant.
static int BACKGROUND_RED
          Background color constant.
static int FOREGROUND_BLUE
          Forground color constant.
static int FOREGROUND_GREEN
          Forground color constant.
static int FOREGROUND_INTENSITY
          Forground color constant.
static int FOREGROUND_RED
          Forground color constant.
 
Fields inherited from class com.yifanlu.Josh.ConsoleAttribute
attributes, COMMON_LVB_GRID_HORIZONTAL, COMMON_LVB_GRID_LVERTICAL, COMMON_LVB_GRID_RVERTICAL, COMMON_LVB_LEADING_BYTE, COMMON_LVB_REVERSE_VIDEO, COMMON_LVB_TRAILING_BYTE, COMMON_LVB_UNDERSCORE
 
Constructor Summary
ConsoleColor(boolean red, boolean blue, boolean green, boolean bright, boolean background)
          Create a new color object by specifying which colors to show.
 
Method Summary
static ConsoleColor BLACK()
          Deprecated. Same as BLACK(false)
static ConsoleColor BLACK(boolean bright)
          Creates and returns a black color attribute.
static ConsoleColor BLUE()
          Deprecated. Same as BLUE(false)
static ConsoleColor BLUE(boolean bright)
          Creates and returns a blue color attribute.
static ConsoleColor CRYAN()
          Deprecated. Same as CRYAN(false)
static ConsoleColor CRYAN(boolean bright)
          Creates and returns a cryan color attribute.
static ConsoleColor GREEN()
          Deprecated. Same as GREEN(false)
static ConsoleColor GREEN(boolean bright)
          Creates and returns a green color attribute.
static ConsoleColor MAGENTA()
          Deprecated. Same as MAGENTA(false)
static ConsoleColor MAGENTA(boolean bright)
          Creates and returns a magenta color attribute.
 void makeBackground()
          Makes any color in the attribute a background color (highlight).
 void makeForeground()
          Makes any color in the attribute a foreground color (text color).
static ConsoleColor RED()
          Deprecated. Same as RED(false)
static ConsoleColor RED(boolean bright)
          Creates and returns a red color attribute.
static ConsoleColor WHITE()
          Deprecated. Same as WHITE(false)
static ConsoleColor WHITE(boolean bright)
          Creates and returns a white color attribute.
static ConsoleColor YELLOW()
          Deprecated. Same as YELLOW(false)
static ConsoleColor YELLOW(boolean bright)
          Creates and returns a yellow color attribute.
 
Methods inherited from class com.yifanlu.Josh.ConsoleAttribute
addAttributes, equals, getAttributes, hashCode, setAttributes, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

FOREGROUND_BLUE

public static final int FOREGROUND_BLUE
Forground color constant.

See Also:
Windows console attributes constants, Constant Field Values

FOREGROUND_GREEN

public static final int FOREGROUND_GREEN
Forground color constant.

See Also:
Windows console attributes constants, Constant Field Values

FOREGROUND_RED

public static final int FOREGROUND_RED
Forground color constant.

See Also:
Windows console attributes constants, Constant Field Values

FOREGROUND_INTENSITY

public static final int FOREGROUND_INTENSITY
Forground color constant.

See Also:
Windows console attributes constants, Constant Field Values

BACKGROUND_BLUE

public static final int BACKGROUND_BLUE
Background color constant.

See Also:
Windows console attributes constants, Constant Field Values

BACKGROUND_GREEN

public static final int BACKGROUND_GREEN
Background color constant.

See Also:
Windows console attributes constants, Constant Field Values

BACKGROUND_RED

public static final int BACKGROUND_RED
Background color constant.

See Also:
Windows console attributes constants, Constant Field Values

BACKGROUND_INTENSITY

public static final int BACKGROUND_INTENSITY
Background color constant.

See Also:
Windows console attributes constants, Constant Field Values
Constructor Detail

ConsoleColor

public ConsoleColor(boolean red,
                    boolean blue,
                    boolean green,
                    boolean bright,
                    boolean background)
Create a new color object by specifying which colors to show. This constructor creates a color by mixing primary colors (red, blue, green), think of the boolean paramaters as colors to mix together.

Parameters:
red - Mix red.
blue - Mix blue.
green - Mix green.
bright - Makes color bright.
background - This color is a background color (foreground is the text color, background is the color behind the text, like a highlight).
Method Detail

makeBackground

public void makeBackground()
Makes any color in the attribute a background color (highlight).


makeForeground

public void makeForeground()
Makes any color in the attribute a foreground color (text color).


RED

public static final ConsoleColor RED(boolean bright)
Creates and returns a red color attribute. The boolean bright parameter is optional.

Parameters:
bright - Optional: Returns bright red.
Returns:
A red ConsoleColor object.

RED

public static final ConsoleColor RED()
Deprecated. Same as RED(false)

See Also:
RED(boolean)

BLUE

public static final ConsoleColor BLUE(boolean bright)
Creates and returns a blue color attribute. The boolean bright parameter is optional.

Parameters:
bright - Optional: Returns bright blue.
Returns:
A blue ConsoleColor object.

BLUE

public static final ConsoleColor BLUE()
Deprecated. Same as BLUE(false)

See Also:
BLUE(boolean)

GREEN

public static final ConsoleColor GREEN(boolean bright)
Creates and returns a green color attribute. The boolean bright parameter is optional.

Parameters:
bright - Optional: Returns bright green.
Returns:
A green ConsoleColor object.

GREEN

public static final ConsoleColor GREEN()
Deprecated. Same as GREEN(false)

See Also:
GREEN(boolean)

YELLOW

public static final ConsoleColor YELLOW(boolean bright)
Creates and returns a yellow color attribute. The boolean bright parameter is optional.

Parameters:
bright - Optional: Returns bright yellow.
Returns:
A yellow ConsoleColor object.

YELLOW

public static final ConsoleColor YELLOW()
Deprecated. Same as YELLOW(false)

See Also:
YELLOW(boolean)

CRYAN

public static final ConsoleColor CRYAN(boolean bright)
Creates and returns a cryan color attribute. The boolean bright parameter is optional.

Parameters:
bright - Optional: Returns bright cryan.
Returns:
A cryan ConsoleColor object.

CRYAN

public static final ConsoleColor CRYAN()
Deprecated. Same as CRYAN(false)

See Also:
CRYAN(boolean)

MAGENTA

public static final ConsoleColor MAGENTA(boolean bright)
Creates and returns a magenta color attribute. The boolean bright parameter is optional.

Parameters:
bright - Optional: Returns bright magenta.
Returns:
A magenta ConsoleColor object.

MAGENTA

public static final ConsoleColor MAGENTA()
Deprecated. Same as MAGENTA(false)

See Also:
MAGENTA(boolean)

WHITE

public static final ConsoleColor WHITE(boolean bright)
Creates and returns a white color attribute. The boolean bright parameter is optional.

Parameters:
bright - Optional: Returns bright white.
Returns:
A white ConsoleColor object.

WHITE

public static final ConsoleColor WHITE()
Deprecated. Same as WHITE(false)

See Also:
WHITE(boolean)

BLACK

public static final ConsoleColor BLACK(boolean bright)
Creates and returns a black color attribute. The boolean bright parameter is optional.

Parameters:
bright - Optional: Returns bright black.
Returns:
A black ConsoleColor object.

BLACK

public static final ConsoleColor BLACK()
Deprecated. Same as BLACK(false)

See Also:
BLACK(boolean)

Copyright © 2010 Yifan Lu