Bitburner – Using Colors to Print

How to Use Colors to Print

Please note: all credit goes to ( º ͜ʖ ͡º) ノ!

Code

You only need to use the available keywords at the start of the print command for it to change color.

Known

Keyword / Color

  • INFO – blue
  • WARN – yellow
  • WARNING – yellow
  • ERROR – red

Here is a simple code to output the available colors and see them in the terminal:

/** @param {NS} ns **/
export async function main(ns) {
    ns.tprintf('INFO---available log colors:')
    ns.tprintf('INFOthey only need to be at the start')
    ns.tprintf(`otherwise INFO or others won't work`)
    ns.tprintf('WARN this is a warning')
    ns.tprintf('WARNING this is also warning')
    ns.tprintf('ERROR this is an error')
} 

This will output in terminal:

Egor Opleuha
About Egor Opleuha 8081 Articles
Egor Opleuha, also known as Juzzzie, is the Editor-in-Chief of Gameplay Tips. He is a writer with more than 12 years of experience in writing and editing online content. His favorite game was and still is the third part of the legendary Heroes of Might and Magic saga. He prefers to spend all his free time playing retro games and new indie games.

Be the first to comment

Leave a Reply

Your email address will not be published.


*