var net =require('net')
var server=net.createServer(function(conn){
console.log('\033[90m new connection!\033[39m')
})
server.listen(3000,function(){console.log('\033[96m server listening on *:3000\033[39m');})
迷茫2017-04-17 11:06:29
This is to change the color of the text displayed on the terminal. The documentation can be found here (in English). The name is probably Terminal escape sequence.
Because there is only one plain text channel for communication between the host and the terminal, the terminal function was enhanced in the later period, and it could move up, down, left, and right, and display different colors, all of which had to be implemented through this escape sequence. The various colors, cursor control, screen clearing, etc. you see in the terminal are all achieved through this escape sequence. The control sequences of different terminals are different, so there are such things as terminfo and termcap. But now they are basically unified. Terminal emulators in graphical interfaces generally use the xterm set of codes (so directly hardcoding these escape sequences generally does not cause problems).
I have collected here a very beautiful script that displays various colors supported by the 256-color terminal. You can play with it~