Syntonic Developer Blog

slackicons - Open Source Explorers 1


Recently I had the need to generate randomized images for users on the fly, and I decided to roll my own solution from scratch. I could have used something like identicons - like what Github uses - but I thought it might be more interesting to create some images that mirror Slack’s default avatars.

like this

Here’s an example of how to generate one of these icons:


const fs = require('fs');
const slackicons = require('slackicons');

const options = {
    seed: 'slackicons',
    size: 500

// Creates a 500x500 .png
slackicons.generate(options).then((buffer) => {
    fs.writeFileSync('./output.png', buffer);
}).catch((err) => {
    console.error(`Error: ${err}`);

And this is what the generated image looks like:

like that

The package is available from npm with the following command, or on Github

npm install slackicons