Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const WIDTH = 32
const fs = require('fs')
const chalk = require('chalk')
const hsl2rgb = require('pure-color/convert/hsl2rgb')
// const e = require('emoji.json')
const file = fs.readFileSync(process.argv[2])
file.forEach((char, index) => {
const rgb = hsl2rgb([char / 256 * 360, 100, 50]).map(i => Math.floor(i))
const hex = [char >> 4, char && 0x0f]
const string =
hex[0].toString(16).toUpperCase() +
hex[1].toString(16).toUpperCase() +
chalk.black.bgBlack(' ')
// const string = e[char].char + ' '
const result = chalk.black.bgRgb(rgb[0], rgb[1], rgb[2])(string)
process.stdout.write(result)
if (index % WIDTH === WIDTH - 1) console.log()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.