Marak / colors.js

get colors in your node.js console
https://github.com/Marak/colors.js
Other
5.17k stars 446 forks source link

Cannot read property 'bgBlue' of undefined #244

Closed SpiritUrban closed 5 years ago

SpiritUrban commented 5 years ago

...\node_modules\colors\lib\extendStringPrototype.js:79 tmp = tmp[theme[prop][t]]; ^

TypeError: Cannot read property 'bgBlue' of undefined

SpiritUrban commented 5 years ago
"colors": "^1.3.2",
SpiritUrban commented 5 years ago

For resolving this problem. I use "colors": "1.3.0",

DABH commented 5 years ago

Can you please provide a code sample that triggered that error?

SpiritUrban commented 5 years ago

module.exports = function (app) {

var colors = require('colors')

colors.setTheme({
    silly: 'rainbow',
    input: 'grey',
    verbose: 'cyan',
    prompt: 'grey',
    info: 'green',
    data: 'grey',
    help: 'cyan',
    warn: 'yellow',
    debug: 'blue',
    error: 'red',
    test: ['yellow'],
    custom: ['red', 'underline', 'america', 'bgBlue']
})
DABH commented 5 years ago

This was a frustrating one to fix! Check out v1.3.3 though, I think your example runs. Whew.

Note that the expected behavior from colors still might not be what you want because nesting of ASCII color codes is very finicky (not a problem with colors, just the nature of how color codes work).