Lines Matching defs:foreground
237 * @param findFg if true, we assume {@param color} is a foreground, otherwise a background.
377 public static int compositeColors(@ColorInt int foreground, @ColorInt int background) {
379 int fgAlpha = Color.alpha(foreground);
382 int r = compositeComponent(Color.red(foreground), fgAlpha,
384 int g = compositeComponent(Color.green(foreground), fgAlpha,
386 int b = compositeComponent(Color.blue(foreground), fgAlpha,
414 * Returns the contrast ratio between {@code foreground} and {@code background}.
420 public static double calculateContrast(@ColorInt int foreground, @ColorInt int background) {
425 if (Color.alpha(foreground) < 255) {
426 // If the foreground is translucent, composite the foreground over the background
427 foreground = compositeColors(foreground, background);
430 final double luminance1 = calculateLuminance(foreground) + 0.05;