How to apply CSS to console.log coloring automatically

This question already has an answer here:

  • How to change node.js's console font color? 24 answers

  • Have a look at color.js. It provides functions to stylize the console output. Usage is as simple as:

    console.log("Yellow text".yellow);
    

    您可以使用图书馆,如粉笔。

    const chalk = require('chalk');
    
    // combine styled and normal strings
    console.log(chalk.blue('Hello') + 'World' + chalk.red('!'));
    
    链接地址: http://www.djcxy.com/p/87372.html

    上一篇: 有没有像Web开发工具一样在WebStorm中对console.log消息进行着色的方法?

    下一篇: 如何自动将CSS应用于console.log着色