Enum AnsiColorFormatter

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      AUTO
      Writes using ANSI colors if it detects that the environment supports color.
      FORCE_COLOR
      Writes with ANSI colors.
      NO_COLOR
      Does not write any color.
    • Enum Constant Detail

      • FORCE_COLOR

        public static final AnsiColorFormatter FORCE_COLOR
        Writes with ANSI colors.
      • AUTO

        public static final AnsiColorFormatter AUTO
        Writes using ANSI colors if it detects that the environment supports color.
    • Method Detail

      • values

        public static AnsiColorFormatter[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (AnsiColorFormatter c : AnsiColorFormatter.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static AnsiColorFormatter valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • detect

        public static AnsiColorFormatter detect()
        Detects if ANSI colors are supported and returns the appropriate Ansi enum variant.

        This method differs from using the AUTO variant directly because it will detect any changes to the environment that might enable or disable colors.

        Returns:
        Returns the detected ANSI color enum variant.