Created
July 6, 2017 22:14
-
-
Save FlorianWendelborn/63e6909c682490cdd5b60e306cf14ea3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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