Class AxeColor

  • All Implemented Interfaces:
    java.lang.Comparable<AxeColor>

    public class AxeColor
    extends java.lang.Object
    implements java.lang.Comparable<AxeColor>
    • Constructor Summary

      Constructors 
      Constructor Description
      AxeColor​(int colorInt)  
      AxeColor​(int alpha, int red, int green, int blue)  
      AxeColor​(java.lang.String hexString)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int blue()
      Return the blue component of a color int.
      int compareTo​(AxeColor o)  
      double contrast​(AxeColor otherColor)
      Calculate contrast between this color and another color.
      boolean equals​(java.lang.Object other)  
      int green()
      Return the green component of a color int.
      int hashCode()  
      boolean isAlmostVisiblySameColor​(AxeColor axeColor)
      Calculates if two colors are visibly same colors.
      int red()
      Return the red component of a color int.
      java.lang.String toHex()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • WHITE

        public static final AxeColor WHITE
      • BLACK

        public static final AxeColor BLACK
    • Constructor Detail

      • AxeColor

        public AxeColor​(@IntRange(from=0L,to=255L)
                        int alpha,
                        @IntRange(from=0L,to=255L)
                        int red,
                        @IntRange(from=0L,to=255L)
                        int green,
                        @IntRange(from=0L,to=255L)
                        int blue)
      • AxeColor

        public AxeColor​(java.lang.String hexString)
      • AxeColor

        public AxeColor​(int colorInt)
    • Method Detail

      • contrast

        public double contrast​(AxeColor otherColor)
        Calculate contrast between this color and another color.
      • isAlmostVisiblySameColor

        public boolean isAlmostVisiblySameColor​(AxeColor axeColor)
        Calculates if two colors are visibly same colors.
        Parameters:
        axeColor - the color to check against.
        Returns:
        true if visibly same by 90 percent.
      • red

        @IntRange(from=0L,
                  to=255L)
        public int red()
        Return the red component of a color int. This is the same as saying (color > > 16) & 0xFF
      • green

        @IntRange(from=0L,
                  to=255L)
        public int green()
        Return the green component of a color int. This is the same as saying (color > > 8) & 0xFF
      • blue

        @IntRange(from=0L,
                  to=255L)
        public int blue()
        Return the blue component of a color int. This is the same as saying color & 0xFF
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(@NonNull
                             AxeColor o)
        Specified by:
        compareTo in interface java.lang.Comparable<AxeColor>
      • equals

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

        public java.lang.String toHex()
      • toString

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