Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save crguezl/384cd359f092c89a7ed76da320c304d3 to your computer and use it in GitHub Desktop.
Save crguezl/384cd359f092c89a7ed76da320c304d3 to your computer and use it in GitHub Desktop.
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