diego's blog

Press the button. Preeeeeess iiiiit...

This is just a bit of html:

<button id="start-colors">Random colors!</button>
<div id="colors" style="height:30em;overflow:scroll;"></div>

And a bit of javascript:

var color_button = document.getElementById("start-colors");

function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

async function get_random_colors () {
    let run_colors = true;
    color_button.innerHTML="Pause";
    color_button.onclick = function () { run_colors = false };
    while (run_colors) {
        let color = "#" + Math.floor(Math.random() * 0xffffff).toString(16).padStart(6,'0');
        let colors = document.getElementById("colors");
        colors.innerHTML = '<div style="background-color:' + color + '">' + color + '</div>' + colors.innerHTML;
        await sleep(100);
    }
    color_button.innerHTML="Random Colors!";
    color_button.onclick = get_random_colors;
}

color_button.onclick = get_random_colors;

I got tired of self-hosting and customizing and doing everything myself. So I'm trying write.as for this blog, and sourcehut for hosting code. Both claim to support privacy and open source, and are fairly simple and straightforward. Probably as good as it gets for non-DIY, non-big-tech solutions.

For similar reasons, I've changed from Arch Linux + BSPWM to Fedora + Gnome recently. I can always go back to my old ways if the need or desire returns. But for now, I'd just like to use software that works while staying as close as possible to free and open source values. It's ok for some software to just be tools that support my other hobbies. My priorities have changed, and I want to have more time for making music and maybe writing fun code (rather than maintaining infrastructure).

So here we are. We'll see.