Either add the class and the line global.console = new Console()
in your main file, or put it in another folder and require/import the file in your main file.
Basically, in your main file you add require('path/to/the/file/console.color')
.
It will allow you to use the command console.color(<string>)
anywhere.
Colors are used the same way as minecraft: &<code>
Code: console.color('&a[&dTest&a] &bThis is an example.')
Result: