Class TrueColor

  • All Implemented Interfaces:
    AnsiColorProvider

    public class TrueColor
    extends java.lang.Object
    implements AnsiColorProvider
    True (24 bit) colours i.e. 16 million possible colours
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int b  
      private int g  
      private int r  
    • Constructor Summary

      Constructors 
      Constructor Description
      TrueColor​(int red, int green, int blue)  
      TrueColor​(java.lang.String hex)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private int checkColor​(int c, java.lang.String argName)  
      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 toHex()  
      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

      • r

        private final int r
      • g

        private final int g
      • b

        private final int b
    • Constructor Detail

      • TrueColor

        public TrueColor​(int red,
                         int green,
                         int blue)
      • TrueColor

        public TrueColor​(java.lang.String hex)
    • Method Detail

      • checkColor

        private int checkColor​(int c,
                               java.lang.String argName)
      • 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
      • toHex

        public java.lang.String toHex()
      • equals

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