let start;
let timeout = 1000;
let bg;

function rand () {
    return Math.ceil(Math.random() * 128) + 127;
}

function timedBackground () {
    if(!bg || (new Date()).getTime() - timeout > start){
        start = (new Date()).getTime();
        let
            r = rand(),
            g = rand(),
            b = rand();
        bg = `rgb(${r},${g},${b})`;
    }
    return bg;
}

export default function background () {
    return timedBackground();
}