code: public static Color interpolateColor( Color color1, Color color2, float fraction ) {
          float int2Float = 1f / 255f;
          fraction = Math.min(fraction, 1f);
          fraction = Math.max(fraction, 0f);
  
          float r1 = color1.getRed() * int2Float;
          float g1 = color1.getGreen() * int2Float;
          float b1 = color1.getBlue() * int2Float;
          float a1 = color1.getAlpha() * int2Float;
  
          float r2 = color2.getRed() * int2Float;
          float g2 = color2.getGreen() * int2Float;
          float b2 = color2.getBlue() * int2Float;
          float a2 = color2.getAlpha() * int2Float;
  
          float deltaR = r2 - r1;
          float deltaG = g2 - g1;
          float deltaB = b2 - b1;
          float deltaA = a2 - a1;
  
          float red = r1 + (deltaR * fraction);
          float green = g1 + (deltaG * fraction);
          float blue = b1 + (deltaB * fraction);
          float alpha = a1 + (deltaA * fraction);
  
          red = Math.min(red, 1f);
          red = Math.max(red, 0f);
          green = Math.min(green, 1f);
          green = Math.max(green, 0f);
          blue = Math.min(blue, 1f);
          blue = Math.max(blue, 0f);
          alpha = Math.min(alpha, 1f);
          alpha = Math.max(alpha, 0f);
  
          return new Color(red, green, blue, alpha);
      }
docs: Interpolate a color at a given fraction between 0 and 1.
  
  @param color1 start color.
  @param color2 end color.
  @param fraction the fraction to interpolate.
  @return the new color.