Class Attribute
java.lang.Object
com.diogonunes.jcolor.Attribute
Abstracts ANSI codes with intuitive names. It maps a description (e.g. RED_TEXT) with a code (e.g. 31).
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AttributeBACK_COLOR(int colorNumber) Paints the background using an 8-bit color from the 256-color palette.static AttributeBACK_COLOR(int r, int g, int b) Paints the background using a 24-bit true color (RGB).static AttributeReturns An Attribute that paints the background black.static AttributeReturns An Attribute that paints the text black.static AttributeReturns An Attribute that paints the background blue.static AttributeReturns An Attribute that paints the text blue.static AttributeBOLD()Returns An Attribute that makes text bold.static AttributeReturns An Attribute that paints the background bright black.static AttributeReturns An Attribute that paints the text bright black.static AttributeReturns An Attribute that paints the background bright blue.static AttributeReturns An Attribute that paints the text bright blue.static AttributeReturns An Attribute that paints the background bright cyan.static AttributeReturns An Attribute that paints the text bright cyan.static AttributeReturns An Attribute that paints the background bright green.static AttributeReturns An Attribute that paints the text bright green.static AttributeReturns An Attribute that paints the background bright magenta.static AttributeReturns An Attribute that paints the text bright magenta.static AttributeReturns An Attribute that paints the background bright red.static AttributeReturns An Attribute that paints the text bright red.static AttributeReturns An Attribute that paints the background bright white.static AttributeReturns An Attribute that paints the text bright white.static AttributeReturns An Attribute that paints the background bright yellow.static AttributeReturns An Attribute that paints the text bright yellow.static AttributeCLEAR()Returns An Attribute that clears any format, restoring the terminal's default.static AttributeReturns An Attribute that paints the background cyan.static AttributeReturns An Attribute that paints the text cyan.static AttributeReturns An Attribute that dims the text (alias ofDIM()).static AttributeDIM()Returns An Attribute that dims the text.static AttributeReturns An Attribute that encircles the text.static AttributeFRAMED()Returns An Attribute that draws a frame around the text.static AttributeReturns An Attribute that paints the background green.static AttributeReturns An Attribute that paints the text green.static AttributeHIDDEN()Returns An Attribute that hides the text (same color as background).static AttributeITALIC()Returns An Attribute that makes text italic.static AttributeReturns An Attribute that paints the background magenta.static AttributeReturns An Attribute that paints the text magenta.static AttributeNONE()Returns An Attribute that applies no formatting.static AttributeReturns An Attribute that draws a line above the text.static AttributeReturns An Attribute that makes the text blink rapidly.static AttributeRED_BACK()Returns An Attribute that paints the background red.static AttributeRED_TEXT()Returns An Attribute that paints the text red.static AttributeREVERSE()Returns An Attribute that swaps foreground and background colors.static AttributeReturns An Attribute that makes text bold (alias ofBOLD()).static AttributeReturns An Attribute that makes the text blink slowly.static AttributeReturns An Attribute that strikes through the text.static AttributeTEXT_COLOR(int colorNumber) Paints the text using an 8-bit color from the 256-color palette.static AttributeTEXT_COLOR(int r, int g, int b) Paints the text using a 24-bit true color (RGB).abstract StringtoString()Returns the Attribute's ANSI escape code.static AttributeReturns An Attribute that underlines the text.static AttributeReturns An Attribute that paints the background white.static AttributeReturns An Attribute that paints the text white.static AttributeReturns An Attribute that paints the background yellow.static AttributeReturns An Attribute that paints the text yellow.
-
Constructor Details
-
Attribute
protected Attribute()Default constructor for subclasses.
-
-
Method Details
-
toString
-
NONE
Returns An Attribute that applies no formatting.- Returns:
- An Attribute that applies no formatting
-
CLEAR
Returns An Attribute that clears any format, restoring the terminal's default.- Returns:
- An Attribute that clears any format, restoring the terminal's default
-
BOLD
Returns An Attribute that makes text bold.- Returns:
- An Attribute that makes text bold
-
SATURATED
-
DIM
Returns An Attribute that dims the text.- Returns:
- An Attribute that dims the text
-
DESATURATED
-
ITALIC
Returns An Attribute that makes text italic.- Returns:
- An Attribute that makes text italic
-
UNDERLINE
Returns An Attribute that underlines the text.- Returns:
- An Attribute that underlines the text
-
SLOW_BLINK
Returns An Attribute that makes the text blink slowly.- Returns:
- An Attribute that makes the text blink slowly
-
RAPID_BLINK
Returns An Attribute that makes the text blink rapidly.- Returns:
- An Attribute that makes the text blink rapidly
-
REVERSE
Returns An Attribute that swaps foreground and background colors.- Returns:
- An Attribute that swaps foreground and background colors
-
HIDDEN
Returns An Attribute that hides the text (same color as background).- Returns:
- An Attribute that hides the text (same color as background)
-
STRIKETHROUGH
Returns An Attribute that strikes through the text.- Returns:
- An Attribute that strikes through the text
-
FRAMED
Returns An Attribute that draws a frame around the text.- Returns:
- An Attribute that draws a frame around the text
-
ENCIRCLED
Returns An Attribute that encircles the text.- Returns:
- An Attribute that encircles the text
-
OVERLINED
Returns An Attribute that draws a line above the text.- Returns:
- An Attribute that draws a line above the text
-
BLACK_TEXT
Returns An Attribute that paints the text black.- Returns:
- An Attribute that paints the text black
-
RED_TEXT
Returns An Attribute that paints the text red.- Returns:
- An Attribute that paints the text red
-
GREEN_TEXT
Returns An Attribute that paints the text green.- Returns:
- An Attribute that paints the text green
-
YELLOW_TEXT
Returns An Attribute that paints the text yellow.- Returns:
- An Attribute that paints the text yellow
-
BLUE_TEXT
Returns An Attribute that paints the text blue.- Returns:
- An Attribute that paints the text blue
-
MAGENTA_TEXT
Returns An Attribute that paints the text magenta.- Returns:
- An Attribute that paints the text magenta
-
CYAN_TEXT
Returns An Attribute that paints the text cyan.- Returns:
- An Attribute that paints the text cyan
-
WHITE_TEXT
Returns An Attribute that paints the text white.- Returns:
- An Attribute that paints the text white
-
BLACK_BACK
Returns An Attribute that paints the background black.- Returns:
- An Attribute that paints the background black
-
RED_BACK
Returns An Attribute that paints the background red.- Returns:
- An Attribute that paints the background red
-
GREEN_BACK
Returns An Attribute that paints the background green.- Returns:
- An Attribute that paints the background green
-
YELLOW_BACK
Returns An Attribute that paints the background yellow.- Returns:
- An Attribute that paints the background yellow
-
BLUE_BACK
Returns An Attribute that paints the background blue.- Returns:
- An Attribute that paints the background blue
-
MAGENTA_BACK
Returns An Attribute that paints the background magenta.- Returns:
- An Attribute that paints the background magenta
-
CYAN_BACK
Returns An Attribute that paints the background cyan.- Returns:
- An Attribute that paints the background cyan
-
WHITE_BACK
Returns An Attribute that paints the background white.- Returns:
- An Attribute that paints the background white
-
BRIGHT_BLACK_TEXT
Returns An Attribute that paints the text bright black.- Returns:
- An Attribute that paints the text bright black
-
BRIGHT_RED_TEXT
Returns An Attribute that paints the text bright red.- Returns:
- An Attribute that paints the text bright red
-
BRIGHT_GREEN_TEXT
Returns An Attribute that paints the text bright green.- Returns:
- An Attribute that paints the text bright green
-
BRIGHT_YELLOW_TEXT
Returns An Attribute that paints the text bright yellow.- Returns:
- An Attribute that paints the text bright yellow
-
BRIGHT_BLUE_TEXT
Returns An Attribute that paints the text bright blue.- Returns:
- An Attribute that paints the text bright blue
-
BRIGHT_MAGENTA_TEXT
Returns An Attribute that paints the text bright magenta.- Returns:
- An Attribute that paints the text bright magenta
-
BRIGHT_CYAN_TEXT
Returns An Attribute that paints the text bright cyan.- Returns:
- An Attribute that paints the text bright cyan
-
BRIGHT_WHITE_TEXT
Returns An Attribute that paints the text bright white.- Returns:
- An Attribute that paints the text bright white
-
BRIGHT_BLACK_BACK
Returns An Attribute that paints the background bright black.- Returns:
- An Attribute that paints the background bright black
-
BRIGHT_RED_BACK
Returns An Attribute that paints the background bright red.- Returns:
- An Attribute that paints the background bright red
-
BRIGHT_GREEN_BACK
Returns An Attribute that paints the background bright green.- Returns:
- An Attribute that paints the background bright green
-
BRIGHT_YELLOW_BACK
Returns An Attribute that paints the background bright yellow.- Returns:
- An Attribute that paints the background bright yellow
-
BRIGHT_BLUE_BACK
Returns An Attribute that paints the background bright blue.- Returns:
- An Attribute that paints the background bright blue
-
BRIGHT_MAGENTA_BACK
Returns An Attribute that paints the background bright magenta.- Returns:
- An Attribute that paints the background bright magenta
-
BRIGHT_CYAN_BACK
Returns An Attribute that paints the background bright cyan.- Returns:
- An Attribute that paints the background bright cyan
-
BRIGHT_WHITE_BACK
Returns An Attribute that paints the background bright white.- Returns:
- An Attribute that paints the background bright white
-
TEXT_COLOR
Paints the text using an 8-bit color from the 256-color palette.- Parameters:
colorNumber- A number (0-255) that represents an 8-bit color.- Returns:
- An Attribute that represents a foreground with an 8-bit color.
-
TEXT_COLOR
Paints the text using a 24-bit true color (RGB).- Parameters:
r- A number (0-255) that represents the red component.g- A number (0-255) that represents the green component.b- A number (0-255) that represents the blue component.- Returns:
- An Attribute that represents a foreground with a true color.
-
BACK_COLOR
Paints the background using an 8-bit color from the 256-color palette.- Parameters:
colorNumber- A number (0-255) that represents an 8-bit color.- Returns:
- An Attribute that represents a background with an 8-bit color.
-
BACK_COLOR
Paints the background using a 24-bit true color (RGB).- Parameters:
r- A number (0-255) that represents the red component.g- A number (0-255) that represents the green component.b- A number (0-255) that represents the blue component.- Returns:
- An Attribute that represents a background with a true color.
-