node.js - \033[90m 这种是转义把? 是什么意思呢?
大家讲道理
大家讲道理 2017-04-17 11:04:29
0
1
618
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');})
大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
迷茫

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~

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template