Class AxeColor

java.lang.Object
com.deque.axe.android.colorcontrast.AxeColor
All Implemented Interfaces:
Comparable<AxeColor>

public class AxeColor extends Object implements Comparable<AxeColor>
  • Field Details

    • WHITE

      public static final AxeColor WHITE
    • BLACK

      public static final AxeColor BLACK
  • Constructor Details

    • 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(String hexString)
    • AxeColor

      public AxeColor(int colorInt)
  • Method Details

    • 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 Object
    • compareTo

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

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • toHex

      public String toHex()
    • toString

      public String toString()
      Overrides:
      toString in class Object