function getSunlightColor(map, time) {
    const center = map.getCenter(),
        {sunrise, sunset} = SunCalc.getTimes(time, center.lat, center.lng),
        sunriseTime = sunrise.getTime(),
        sunsetTime = sunset.getTime();
    let t, r, g, b;

    if (time >= sunriseTime - HOUR && time < sunriseTime) {
        // Night to sunrise
        t = (time - sunriseTime) / HOUR + 1;
        r = lerp(.4, .8, t);
        g = lerp(.4, .9, t);
        b = lerp(.5, 1, t);
    } else if (time >= sunriseTime && time < sunriseTime + HOUR) {
        // Sunrise to day
        t = (time - sunriseTime) / HOUR;
        r = lerp(.8, 1, t);
        g = lerp(.9, 1, t);
        b = 1;
    } else if (time >= sunriseTime + HOUR && time < sunsetTime - HOUR) {
        // Day
        r = g = b = 1;
    } else if (time >= sunsetTime - HOUR && time < sunsetTime) {
        // Day to sunset
        t = (time - sunsetTime) / HOUR + 1;
        r = 1;
        g = lerp(1, .9, t);
        b = lerp(1, .8, t);
    } else if (time >= sunsetTime && time < sunsetTime + HOUR) {
        // Sunset to night
        t = (time - sunsetTime) / HOUR;
        r = lerp(1, .4, t);
        g = lerp(.9, .4, t);
        b = lerp(.8, .5, t);
    } else {
        // Night
        r = g = .4;
        b = .5;
    }
    return {r, g, b};
}
Returns the sunlight color at a specific time.
@param {mapboxgl.Map} map - Mapbox's Map object
@param {number} time - The number of milliseconds elapsed since January 1,
    1970 00:00:00 UTC
@returns {Object} Color object