Bitburner – How to Print with Using Color

A guide on how to print with using color in Bitburner.

How to Print with Using Color

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:

[home ~/]> run consol eColors.ns
Running script with 1 thread(s), pid 19 and args: [].
INFO---available log colors:
INFOthey only need to be at the start otherwise INFO or others won't work
WARN this is a warning
WARNING this is also warning t-.RROR this is an error
[home ~/]> I

by ( º ͜ʖ ͡º) ノ


Similar Posts:


Share your love

Leave a Reply