Skip to content

Instantly share code, notes, and snippets.

@avelino
Created July 27, 2012 14:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avelino/3188205 to your computer and use it in GitHub Desktop.
Save avelino/3188205 to your computer and use it in GitHub Desktop.
Como deixar o retorno do Node.js colorido
'use strict';
//// http://avelino.us/2012/07/27/console-colorido-usando-node-js
////
// Retorna o texto em vermelho
console.log("\033[31m Aqui esta o texto em vermelho.")
// Retorna o texto em azul
console.log("\033[34m Aqui esta o texto em azul.")
// Volta o padrão do bash
console.log("\033[0m Aqui estamos dando reset nas cores do bash.")
// Criando variavel para deixar um pouco mais simples
var red, blue, reset;
red = '\u001b[31m';
blue = '\u001b[34m';
reset = '\u001b[0m';
console.log(red +"Aqui esta o texto em vermelho. "+ blue +"Aqui esta o texto em vermelho. "+ reset +"Aqui estamos dando reset nas cores do bash.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment