pub fn color_gradient(gray: Luma<u8>, low: Rgb<u8>, mid: Rgb<u8>, high: Rgb<u8>) -> Rgb<u8> {
    let fraction = gray[0] as f32 / 255f32;
    let (lower, upper, offset) = if fraction < 0.5 {
        (low, mid, 0.0)
    } else {
        (mid, high, 0.5)
    };
    let right_weight = 2.0 * (fraction - offset);
    let left_weight = 1.0 - right_weight;
    weighted_sum(lower, upper, left_weight, right_weight)
}
Linearly interpolates between low and mid colors for pixel intensities less than
half of maximum brightness and between mid and high for those above.
examples/color_effects.rs