0

I am creating a JS RPG CLI game and I have a question about styled output. Once executed, the script outputs a framed Welcome. I need that frame to be colored and the text within needs to be white.

I need this: https://i.stack.imgur.com/XuYYK.png

I did it with the simple console.log():

    console.log(`
    +-----------------------------+
    |          Welcome !          |
    +-----------------------------+
    `)

To change color I am using simple color references of text:

console.log('\x1b[36m%s\x1b[0m', `
    +-----------------------------+
    |          Welcome !          |
    +-----------------------------+
    `)`

My output is: https://i.stack.imgur.com/NHtaU.png This changes the color of everything, including the Welcome text and I need that white.

So, how to do that ?

Also, given that I am using that frame throughout the code, is it possible to create a separate function that will automatically create a frame when called ?

TheVSDev
  • 112
  • 13

0 Answers0