Did you know you can use colors to print output?
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:
Feel free to comment with anything else you know.
Written by 👌( º ͜ʖ ͡º) ノ🍺
Hope you enjoy the Guide about Bitburner – Color Code to Print Guide, if you think we should add extra information or forget something, please let us know via comment below, and we will do our best to fix or update as soon as possible!
Recommended for You:
- All Bitburner Posts List
Leave a Reply