Skip to content

Instantly share code, notes, and snippets.

@Sinequanonh
Created October 29, 2017 22:38
Show Gist options
  • Save Sinequanonh/611b9d157eed3c6f07e934039448ab64 to your computer and use it in GitHub Desktop.
Save Sinequanonh/611b9d157eed3c6f07e934039448ab64 to your computer and use it in GitHub Desktop.
Colorizes javascript strings
const red = '\033[31m'
const green = '\033[32m'
const magenta = '\033[35m'
const cyan = '\033[36m'
const blue = '\033[34m'
const yellow = '\033[33m'
const white = '\033[0m'
module.exports = {
red(string) {
return red + string + white
},
green(string) {
return green + string + white
},
cyan(string) {
return cyan + string + white
},
yellow(string) {
return yellow + string + white
},
blue(string) {
return blue + string + white
},
magenta(string) {
return magenta + string + white
},
white(string) {
return white + string + white
}
}
// const colorize = require(./colorize.js)
// console.log(colorize.green('Hello world'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment