Ejemplo n.º 1
0
 /**
  * Test is a color is lighter than {@code this}
  *
  * @param other A color
  * @return {@code true} if {@code other} is lighter than {@code this}, else {@code false}
  */
 public boolean isLighter(int other) {
   return getLuminance() > ColorUtils.calculateLuminance(other);
 }
Ejemplo n.º 2
0
 /**
  * Convert this color into a Hue, Saturation, Value human readable string
  *
  * @return A string
  */
 public String toHSVString() {
   return ColorUtils.toHsvString(mColor);
 }
Ejemplo n.º 3
0
 /**
  * Test is a color is darker than {@code this}
  *
  * @param other A color
  * @return {@code true} if {@code other} is darker than {@code this}, else {@code false}
  */
 public boolean isDarker(int other) {
   return getLuminance() < ColorUtils.calculateLuminance(other);
 }
Ejemplo n.º 4
0
 @Override
 public String toString() {
   return ColorUtils.toARGBString(mColor);
 }
Ejemplo n.º 5
0
 @Override
 public double getLuminance() {
   return ColorUtils.calculateLuminance(mColor);
 }
Ejemplo n.º 6
0
 /**
  * @param brightBackground {@code true} if the background is bright, else {@code false}
  * @return A foreground text color to fit the background
  */
 public static int getDisabledTextColor(boolean brightBackground) {
   int color = brightBackground ? Color.BLACK : Color.WHITE;
   int alpha = brightBackground ? TEXT_ALPHA_DISABLED_DARK : TEXT_ALPHA_DISABLED_LIGHT;
   return ColorUtils.setAlphaComponent(color, alpha);
 }
Ejemplo n.º 7
0
 /**
  * @param brightBackground {@code true} if the background is bright, else {@code false}
  * @return A foreground text color to fit the background
  */
 public static int getSecondaryTextColor(boolean brightBackground) {
   int color = brightBackground ? Color.BLACK : Color.WHITE;
   int alpha = brightBackground ? TEXT_ALPHA_SECONDARY_DARK : TEXT_ALPHA_SECONDARY_LIGHT;
   return ColorUtils.setAlphaComponent(color, alpha);
 }