Class Attribute

java.lang.Object
com.diogonunes.jcolor.Attribute

public abstract class Attribute extends Object
Abstracts ANSI codes with intuitive names. It maps a description (e.g. RED_TEXT) with a code (e.g. 31).
See Also:
  • Constructor Details

    • Attribute

      protected Attribute()
      Default constructor for subclasses.
  • Method Details

    • toString

      public abstract String toString()
      Returns the Attribute's ANSI escape code.
      Overrides:
      toString in class Object
      Returns:
      the Attribute's ANSI escape code
    • NONE

      public static Attribute NONE()
      Returns An Attribute that applies no formatting.
      Returns:
      An Attribute that applies no formatting
    • CLEAR

      public static Attribute 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

      public static Attribute BOLD()
      Returns An Attribute that makes text bold.
      Returns:
      An Attribute that makes text bold
    • SATURATED

      public static Attribute SATURATED()
      Returns An Attribute that makes text bold (alias of BOLD()).
      Returns:
      An Attribute that makes text bold (alias of BOLD())
    • DIM

      public static Attribute DIM()
      Returns An Attribute that dims the text.
      Returns:
      An Attribute that dims the text
    • DESATURATED

      public static Attribute DESATURATED()
      Returns An Attribute that dims the text (alias of DIM()).
      Returns:
      An Attribute that dims the text (alias of DIM())
    • ITALIC

      public static Attribute ITALIC()
      Returns An Attribute that makes text italic.
      Returns:
      An Attribute that makes text italic
    • UNDERLINE

      public static Attribute UNDERLINE()
      Returns An Attribute that underlines the text.
      Returns:
      An Attribute that underlines the text
    • SLOW_BLINK

      public static Attribute SLOW_BLINK()
      Returns An Attribute that makes the text blink slowly.
      Returns:
      An Attribute that makes the text blink slowly
    • RAPID_BLINK

      public static Attribute RAPID_BLINK()
      Returns An Attribute that makes the text blink rapidly.
      Returns:
      An Attribute that makes the text blink rapidly
    • REVERSE

      public static Attribute REVERSE()
      Returns An Attribute that swaps foreground and background colors.
      Returns:
      An Attribute that swaps foreground and background colors
    • HIDDEN

      public static Attribute HIDDEN()
      Returns An Attribute that hides the text (same color as background).
      Returns:
      An Attribute that hides the text (same color as background)
    • STRIKETHROUGH

      public static Attribute STRIKETHROUGH()
      Returns An Attribute that strikes through the text.
      Returns:
      An Attribute that strikes through the text
    • FRAMED

      public static Attribute FRAMED()
      Returns An Attribute that draws a frame around the text.
      Returns:
      An Attribute that draws a frame around the text
    • ENCIRCLED

      public static Attribute ENCIRCLED()
      Returns An Attribute that encircles the text.
      Returns:
      An Attribute that encircles the text
    • OVERLINED

      public static Attribute OVERLINED()
      Returns An Attribute that draws a line above the text.
      Returns:
      An Attribute that draws a line above the text
    • BLACK_TEXT

      public static Attribute BLACK_TEXT()
      Returns An Attribute that paints the text black.
      Returns:
      An Attribute that paints the text black
    • RED_TEXT

      public static Attribute RED_TEXT()
      Returns An Attribute that paints the text red.
      Returns:
      An Attribute that paints the text red
    • GREEN_TEXT

      public static Attribute GREEN_TEXT()
      Returns An Attribute that paints the text green.
      Returns:
      An Attribute that paints the text green
    • YELLOW_TEXT

      public static Attribute YELLOW_TEXT()
      Returns An Attribute that paints the text yellow.
      Returns:
      An Attribute that paints the text yellow
    • BLUE_TEXT

      public static Attribute BLUE_TEXT()
      Returns An Attribute that paints the text blue.
      Returns:
      An Attribute that paints the text blue
    • MAGENTA_TEXT

      public static Attribute MAGENTA_TEXT()
      Returns An Attribute that paints the text magenta.
      Returns:
      An Attribute that paints the text magenta
    • CYAN_TEXT

      public static Attribute CYAN_TEXT()
      Returns An Attribute that paints the text cyan.
      Returns:
      An Attribute that paints the text cyan
    • WHITE_TEXT

      public static Attribute WHITE_TEXT()
      Returns An Attribute that paints the text white.
      Returns:
      An Attribute that paints the text white
    • BLACK_BACK

      public static Attribute BLACK_BACK()
      Returns An Attribute that paints the background black.
      Returns:
      An Attribute that paints the background black
    • RED_BACK

      public static Attribute RED_BACK()
      Returns An Attribute that paints the background red.
      Returns:
      An Attribute that paints the background red
    • GREEN_BACK

      public static Attribute GREEN_BACK()
      Returns An Attribute that paints the background green.
      Returns:
      An Attribute that paints the background green
    • YELLOW_BACK

      public static Attribute YELLOW_BACK()
      Returns An Attribute that paints the background yellow.
      Returns:
      An Attribute that paints the background yellow
    • BLUE_BACK

      public static Attribute BLUE_BACK()
      Returns An Attribute that paints the background blue.
      Returns:
      An Attribute that paints the background blue
    • MAGENTA_BACK

      public static Attribute MAGENTA_BACK()
      Returns An Attribute that paints the background magenta.
      Returns:
      An Attribute that paints the background magenta
    • CYAN_BACK

      public static Attribute CYAN_BACK()
      Returns An Attribute that paints the background cyan.
      Returns:
      An Attribute that paints the background cyan
    • WHITE_BACK

      public static Attribute WHITE_BACK()
      Returns An Attribute that paints the background white.
      Returns:
      An Attribute that paints the background white
    • BRIGHT_BLACK_TEXT

      public static Attribute BRIGHT_BLACK_TEXT()
      Returns An Attribute that paints the text bright black.
      Returns:
      An Attribute that paints the text bright black
    • BRIGHT_RED_TEXT

      public static Attribute BRIGHT_RED_TEXT()
      Returns An Attribute that paints the text bright red.
      Returns:
      An Attribute that paints the text bright red
    • BRIGHT_GREEN_TEXT

      public static Attribute BRIGHT_GREEN_TEXT()
      Returns An Attribute that paints the text bright green.
      Returns:
      An Attribute that paints the text bright green
    • BRIGHT_YELLOW_TEXT

      public static Attribute BRIGHT_YELLOW_TEXT()
      Returns An Attribute that paints the text bright yellow.
      Returns:
      An Attribute that paints the text bright yellow
    • BRIGHT_BLUE_TEXT

      public static Attribute BRIGHT_BLUE_TEXT()
      Returns An Attribute that paints the text bright blue.
      Returns:
      An Attribute that paints the text bright blue
    • BRIGHT_MAGENTA_TEXT

      public static Attribute BRIGHT_MAGENTA_TEXT()
      Returns An Attribute that paints the text bright magenta.
      Returns:
      An Attribute that paints the text bright magenta
    • BRIGHT_CYAN_TEXT

      public static Attribute BRIGHT_CYAN_TEXT()
      Returns An Attribute that paints the text bright cyan.
      Returns:
      An Attribute that paints the text bright cyan
    • BRIGHT_WHITE_TEXT

      public static Attribute BRIGHT_WHITE_TEXT()
      Returns An Attribute that paints the text bright white.
      Returns:
      An Attribute that paints the text bright white
    • BRIGHT_BLACK_BACK

      public static Attribute BRIGHT_BLACK_BACK()
      Returns An Attribute that paints the background bright black.
      Returns:
      An Attribute that paints the background bright black
    • BRIGHT_RED_BACK

      public static Attribute BRIGHT_RED_BACK()
      Returns An Attribute that paints the background bright red.
      Returns:
      An Attribute that paints the background bright red
    • BRIGHT_GREEN_BACK

      public static Attribute BRIGHT_GREEN_BACK()
      Returns An Attribute that paints the background bright green.
      Returns:
      An Attribute that paints the background bright green
    • BRIGHT_YELLOW_BACK

      public static Attribute BRIGHT_YELLOW_BACK()
      Returns An Attribute that paints the background bright yellow.
      Returns:
      An Attribute that paints the background bright yellow
    • BRIGHT_BLUE_BACK

      public static Attribute BRIGHT_BLUE_BACK()
      Returns An Attribute that paints the background bright blue.
      Returns:
      An Attribute that paints the background bright blue
    • BRIGHT_MAGENTA_BACK

      public static Attribute BRIGHT_MAGENTA_BACK()
      Returns An Attribute that paints the background bright magenta.
      Returns:
      An Attribute that paints the background bright magenta
    • BRIGHT_CYAN_BACK

      public static Attribute BRIGHT_CYAN_BACK()
      Returns An Attribute that paints the background bright cyan.
      Returns:
      An Attribute that paints the background bright cyan
    • BRIGHT_WHITE_BACK

      public static Attribute BRIGHT_WHITE_BACK()
      Returns An Attribute that paints the background bright white.
      Returns:
      An Attribute that paints the background bright white
    • TEXT_COLOR

      public static Attribute TEXT_COLOR(int colorNumber)
      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

      public static Attribute TEXT_COLOR(int r, int g, int b)
      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

      public static Attribute BACK_COLOR(int colorNumber)
      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

      public static Attribute BACK_COLOR(int r, int g, int b)
      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.