Class Color256

  • All Implemented Interfaces:
    AnsiColorProvider

    public class Color256
    extends java.lang.Object
    implements AnsiColorProvider
    256 colour i.e. palette of 256 colors that most modern terminals will support
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int color  
    • Constructor Summary

      Constructors 
      Constructor Description
      Color256​(int color)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private int checkColor​(int c)  
      boolean equals​(java.lang.Object other)  
      java.lang.String getAnsiBackgroundControlCode()
      Gets the ANSI control code for setting the background colour
      private java.lang.String getAnsiColorCode​(int mode)  
      java.lang.String getAnsiForegroundControlCode()
      Gets the ANSI control code for setting the foreground colour
      java.lang.String toString()  
      boolean usesExtendedColors()
      Gets whether extended colours are used as this will affect the ANSI reset sequence that needs to be used
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • color

        private final int color
    • Constructor Detail

      • Color256

        public Color256​(int color)
    • Method Detail

      • checkColor

        private int checkColor​(int c)
      • getAnsiForegroundControlCode

        public java.lang.String getAnsiForegroundControlCode()
        Description copied from interface: AnsiColorProvider
        Gets the ANSI control code for setting the foreground colour
        Specified by:
        getAnsiForegroundControlCode in interface AnsiColorProvider
        Returns:
        Foreground control code
      • getAnsiBackgroundControlCode

        public java.lang.String getAnsiBackgroundControlCode()
        Description copied from interface: AnsiColorProvider
        Gets the ANSI control code for setting the background colour
        Specified by:
        getAnsiBackgroundControlCode in interface AnsiColorProvider
        Returns:
        Background control code
      • usesExtendedColors

        public boolean usesExtendedColors()
        Description copied from interface: AnsiColorProvider
        Gets whether extended colours are used as this will affect the ANSI reset sequence that needs to be used
        Specified by:
        usesExtendedColors in interface AnsiColorProvider
        Returns:
        True if extended colours are used, false otherwise
      • getAnsiColorCode

        private java.lang.String getAnsiColorCode​(int mode)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object