chalk/chalk

Unable to see colour after newline

TheUntraceable opened this issue · 1 comments

        for(const cachedMessage of selectedChannel.created.sort((a, b) => a.id - b.id)) {

            let messageBlock = ""

            if(lastAuthor != cachedMessage.author.id) {
                messageBlock += chalk.hex(cachedMessage.author_color || "#FFFFFF11").underline(`${cachedMessage.author.username}#${cachedMessage.author.discriminator} (${cachedMessage.author.id})\n`)
                lastAuthor = cachedMessage.author.id
            }
            
            for(const updated of selectedChannel.updated.filter(updated => updated.id == cachedMessage.id)) {
                messageBlock += `  ${chalk.hex("#0000ff")(updated.content)}\n`
            }
            if(selectedChannel.deleted.find(deleted => deleted.id == cachedMessage.id)) {
                console.log("Passed")
                messageBlock += `  ${chalk.red(cachedMessage.content)}\n`
            } else {
                console.log("Failed")
                messageBlock += `  ${cachedMessage.content}\n`
            }

            message += messageBlock
        }

        console.log(message)

The console will print "passed", but the content will never be in red. I am unable to understand the cause of this error, and have been looking around for a few days.
The results are:
image
I expected something like:
image
I have noticed that I used the hex method for the testing, and .red for the production, but I get the same results after using .hex for both.

The issue decided to resolve itself.