Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JavaScript - ANSI Escape Codes

#JavaScript - ANSI Escape Codes

ANSI Escape Codes are special characters which can be used to control formatting, colors or other output preferences in a text terminal. Escape Codes are non-printing code and will not appear in the output directly.

  • \033 begins the escape sequence
  • [ indicates the color
  • 33 is the foreground color for yellow
  • m indicates the end of the setting

Note: \033[39m is used set the color back to the terminal defult

console.log('\033[33m Hello World \033[39m');

This will give a nice yellow color Hello World.

The complete table of ANSI Escape Codes is available at http://en.wikipedia.org/wiki/ANSI_escape_code

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.