Lines Matching defs:background
237 * @param findFg if true, we assume {@param color} is a foreground, otherwise a background.
286 /** Finds a background color for a text view with given text color and hint text color, that
333 + " and %s (over background) by changing #%s to %s",
363 public static int compositeColors(@ColorInt int foreground, @ColorInt int background) {
364 int bgAlpha = Color.alpha(background);
369 Color.red(background), bgAlpha, a);
371 Color.green(background), bgAlpha, a);
373 Color.blue(background), bgAlpha, a);
400 * Returns the contrast ratio between {@code foreground} and {@code background}.
401 * {@code background} must be opaque.
406 public static double calculateContrast(@ColorInt int foreground, @ColorInt int background) {
407 if (Color.alpha(background) != 255) {
408 throw new IllegalArgumentException("background can not be translucent: #"
409 + Integer.toHexString(background));
412 // If the foreground is translucent, composite the foreground over the background
413 foreground = compositeColors(foreground, background);
417 final double luminance2 = calculateLuminance(background) + 0.05;