0

I'm using chalk version ^1.1.3

No idea why it's saying that the method is not recognized:

const chalk = require('chalk'),
  _ = require('lodash'),
  info = chalk.yellow,
  green = chalk.green,
  script = chalk.bgHex('#ebd2f8')

Error: chalk.bgHex is not a function

I also don't know how I'd append a text color on top of that background.

Dark Matter
  • 29
  • 2
  • 9

1 Answers1

1

The commit that introduced hex/bgHex was committed just 2 hours ago. There hasn't been a new publish to the NPM repository with that commit.

If you want to use it, you can use the GitHub-hosted version of the module:

$ npm i chalk/chalk

However, do so with extreme caution. There's probably a reason why the developers haven't published a new version yet (i.e. it's not finished).

robertklep
  • 198,204
  • 35
  • 394
  • 381
  • how can I tell when it's published finally to npm? – Dark Matter Jun 22 '17 at 04:11
  • @DarkMatter I guess you should check https://www.npmjs.com/package/chalk to see when it gets a version bump (although that doesn't necessarily have to mean that a newly published version contains `bgHex`). – robertklep Jun 22 '17 at 05:33