Skip to main content

Class JtvColorAttr

public class JtvColorAttr

Encodes a classic CGA/BIOS 8-bit terminal color attribute.

The byte is split into two nibbles:

  • Bits 3–0 (low nibble): foreground color index (0–15)
  • Bits 7–4 (high nibble): background color index (0–7; bit 7 may enable blinking)

The 16 standard color constants defined here correspond to the IBM PC BIOS color palette. Use JtvColorAttr(int, int) to build an attribute from separate foreground and background values, or pass the raw packed byte directly to JtvColorAttr(int).

org.viktor44.jtvision.core.JtvColorAttr

Summary​

Constructors​

VisibilitySignature
publicJtvColorAttr()
publicJtvColorAttr(int value)
publicJtvColorAttr(int fg, int bg)

Fields​

ModifiersField nameType
public static finalBLACKint
public static finalBLUEint
public static finalGREENint
public static finalCYANint
public static finalREDint
public static finalMAGENTAint
public static finalBROWNint
public static finalLIGHT_GRAYint
public static finalDARK_GRAYint
public static finalLIGHT_BLUEint
public static finalLIGHT_GREENint
public static finalLIGHT_CYANint
public static finalLIGHT_REDint
public static finalLIGHT_MAGENTAint
public static finalYELLOWint
public static finalWHITEint
public static finalLIGHT_GRAY_ON_BLACKorg.viktor44.jtvision.core.JtvColorAttr
public static finalWHITE_ON_WHITEorg.viktor44.jtvision.core.JtvColorAttr
public static finalWHITE_ON_LIGHT_REDorg.viktor44.jtvision.core.JtvColorAttr
private finalvalueint

Methods​

ModifiersMethod signatureReturn type
publicgetForeground()int
publicgetBackground()int
publicgetValue()int
publicequals(Object o)boolean
protectedcanEqual(Object other)boolean
publichashCode()int

Constructors​

JtvColorAttr()​

Constructs the default attribute: light-gray foreground on black background (0x07).

JtvColorAttr(int value)​

Constructs a color attribute from a packed 8-bit value.

Parameters

  • value - raw attribute byte (high nibble = background, low nibble = foreground)

JtvColorAttr(int fg, int bg)​

Constructs a color attribute from separate foreground and background color indices.

Parameters

  • fg - foreground color index (0\u201315, see color constants)
  • bg - background color index (0\u20137)

Fields​

int BLACK​

Black (0x00).

int BLUE​

Blue (0x01).

int GREEN​

Green (0x02).

int CYAN​

Cyan (0x03).

int RED​

Red (0x04).

int MAGENTA​

Magenta (0x05).

int BROWN​

Brown / dark yellow (0x06).

int LIGHT_GRAY​

Light gray (0x07).

int DARK_GRAY​

Dark gray / bright black (0x08).

int LIGHT_BLUE​

Light blue (0x09).

int LIGHT_GREEN​

Light green (0x0A).

int LIGHT_CYAN​

Light cyan (0x0B).

int LIGHT_RED​

Light red / bright red (0x0C).

int LIGHT_MAGENTA​

Light magenta / bright magenta (0x0D).

int YELLOW​

Yellow / bright brown (0x0E).

int WHITE​

White / bright gray (0x0F).

org.viktor44.jtvision.core.JtvColorAttr LIGHT_GRAY_ON_BLACK​

No description provided

org.viktor44.jtvision.core.JtvColorAttr WHITE_ON_WHITE​

No description provided

org.viktor44.jtvision.core.JtvColorAttr WHITE_ON_LIGHT_RED​

No description provided

int value​

No description provided

Methods​

getForeground()​

Returns the foreground color index (bits 3–0 of the attribute byte).

Returns

foreground color, 0\u201315

getBackground()​

Returns the background color index (bits 7–4 of the attribute byte).

Returns

background color, 0\u20137 (bit 3 may be the blink flag)

getValue()​

Returns the raw 8-bit attribute value.

Returns

packed color byte

equals(Object o)​

No method description provided

Parameters

  • o

canEqual(Object other)​

No method description provided

Parameters

  • other

hashCode()​

Overrides:

hashCode() in java.lang.Object

No method description provided