Enum AnsiEscapeCode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<AnsiEscapeCode>, org.refcodes.mixin.CodeAccessor<java.lang.String>

    public enum AnsiEscapeCode
    extends java.lang.Enum<AnsiEscapeCode>
    implements org.refcodes.mixin.CodeAccessor<java.lang.String>
    Some default ANSI Escape-Codes to be prepended or append to your ANSIfied String instances. Set a color e.g. with prepending FG_BLUE_BRIGHT to your String and appending RESET to reset the current ANSI console's state (an ANSI console remembers your settings till them are overwritten or reseted). The codes found here represent just a few possibilities which we placed here as them are used here and there throughout the REFCODES.ORG artifacts. For professional ANSI escape code handling see fusesource' jansi API at "https://github.com/fusesource/jansi".
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.refcodes.mixin.CodeAccessor

        org.refcodes.mixin.CodeAccessor.CodeBuilder<V extends java.lang.Object,B extends org.refcodes.mixin.CodeAccessor.CodeBuilder<V,B>>, org.refcodes.mixin.CodeAccessor.CodeMutator<V extends java.lang.Object>, org.refcodes.mixin.CodeAccessor.CodeProperty<V extends java.lang.Object>
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getCode()
      java.lang.String toEscaped()
      Returns the escaped ANSI Escape-Code to be printable without triggering the actual ANSI escape commands.
      static AnsiEscapeCode valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static AnsiEscapeCode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • RESET

        public static final AnsiEscapeCode RESET
        Reset the current ANSI console's color settings to default settings.
      • FG_WHITE

        public static final AnsiEscapeCode FG_WHITE
        Sets a white foreground (text) color.
      • FG_WHITE_UNDERLINE

        public static final AnsiEscapeCode FG_WHITE_UNDERLINE
        Sets a white underlined foreground (text) color.
      • FG_WHITE_BRIGHT_BG_BLACK

        public static final AnsiEscapeCode FG_WHITE_BRIGHT_BG_BLACK
        Sets a bright white foreground (text) with a black background color.
      • FG_RED_BRIGHT_BOLD

        public static final AnsiEscapeCode FG_RED_BRIGHT_BOLD
        Sets a bright red foreground (text) color.
      • FG_WHITE_BRIGHT_BG_RED

        public static final AnsiEscapeCode FG_WHITE_BRIGHT_BG_RED
        Sets a bright white foreground (text) with a red background color.
      • FG_GREEN_BRIGHT

        public static final AnsiEscapeCode FG_GREEN_BRIGHT
        Sets a bright green foreground (text) color.
      • FG_RED

        public static final AnsiEscapeCode FG_RED
        Sets a red foreground (text) color.
      • FG_BLUE_BRIGHT_BOLD

        public static final AnsiEscapeCode FG_BLUE_BRIGHT_BOLD
        Sets a bright blue foreground (text) color.
      • FG_DEFAULT_BRIGHT

        public static final AnsiEscapeCode FG_DEFAULT_BRIGHT
        Sets a default bright foreground (text) color.
      • FG_BLUE_BRIGHT

        public static final AnsiEscapeCode FG_BLUE_BRIGHT
        Sets a bright blue foreground (text) color.
      • FG_RED_BRIGHT

        public static final AnsiEscapeCode FG_RED_BRIGHT
        Sets a bright red foreground (text) color.
      • FG_YELLOW_BRIGHT_BG_BLUE_BRIGHT

        public static final AnsiEscapeCode FG_YELLOW_BRIGHT_BG_BLUE_BRIGHT
        Sets a bright yellow foreground (text) with a bright blue background color.
      • ESC

        public static final AnsiEscapeCode ESC
        The ANSI Escape-Code with which each ANSI escape sequence is commenced.
    • Method Detail

      • values

        public static AnsiEscapeCode[] 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 (AnsiEscapeCode c : AnsiEscapeCode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static AnsiEscapeCode 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
      • getCode

        public java.lang.String getCode()
        Specified by:
        getCode in interface org.refcodes.mixin.CodeAccessor<java.lang.String>
      • toEscaped

        public java.lang.String toEscaped()
        Returns the escaped ANSI Escape-Code to be printable without triggering the actual ANSI escape commands.
        Returns:
        The escaped ANSI Escape-Code.