Class SGR

java.lang.Object
de.linusdev.lutils.ansi.sgr.SGR

public class SGR extends Object
Select Graphic Rendition for Consoles. This class can construct control sequences to set display attributes of consoles and terminals.

Example usage:
SGR sgr = new SGR(SGRParameters.FOREGROUND_RED);
 System.out.println(sgr.construct() + "Some text in red." + SGR.reset());
 System.out.println("Normal text.")
This will give the following output:
  Some text in red.
 Normal text
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • reset

      @NotNull public static @NotNull String reset()
    • add

      public SGR add(@NotNull @NotNull SGRParameter sgrParam, @NotNull @NotNull String @NotNull ... params)
      Adds given SGRParameter to this SGR.
      Parameters:
      sgrParam - SGRParameter to add.
      params - parameters for sgrParam
      Returns:
      this
    • construct

      @NotNull public @NotNull String construct()
      Constructs the control sequence.
      Returns:
      the constructed control sequence