code: private void processSwatch(Bitmap image) {
          final Map<Integer, Integer> colorHistogram = processLuminanceData(image);
          extractFgBgData(colorHistogram);
  
          // Two-decimal digits of precision for the contrast ratio
          mContrastRatio = Math.round(
                  ContrastUtils.calculateContrastRatio(mBackgroundLuminance, mForegroundLuminance)
                  * 100.0d) / 100.0d;
      }
docs: Compute the background and foreground colors and luminance for the image, and the contrast
  ratio.