Colors in JavaScript console

前端 未结 27 2193
说谎
说谎 2020-11-22 11:42

Can Chrome\'s built-in JavaScript console display colors?

I want errors in red, warnings in orange and console.log\'s in green. Is that possible?

27条回答
  •  孤街浪徒
    2020-11-22 12:09

    I created a package for the same. cslog

    Install it with

    npm i cslog
    

    Use It like this

    import log from 'cslog'
    
    log.h2("This is heading 2")
    log.p("This is colored paragraph")
    log.d(person, "Person Info")
    

    You can give your custom colors as well. here

提交回复
热议问题