Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color configuration not working #1

Closed
grantcarthew opened this issue Jan 22, 2018 · 1 comment
Closed

Color configuration not working #1

grantcarthew opened this issue Jan 22, 2018 · 1 comment

Comments

@grantcarthew
Copy link

Hi,

I'm trying to use this package on the console and the color configuration below does not work:

const t = lines()
t.line({
  from: [0, 0],
  to: [4, 0],
  style: 'bold',
  color: {
    foreground: 'red'
  }
})
t.line({
  from: [2, 0],
  to: [2, 3],
});

I think the ansi-styles package has changed.

Error is as follows:

/home/grant/node-console-probe/node_modules/lines-js/lib/color.js:17
          if (color in style.color) {
                    ^

TypeError: Cannot use 'in' operator to search for 'red' in undefined
    at Object.foreground (/home/grant/node-console-probe/node_modules/lines-js/lib/color.js:17:21)
    at /home/grant/node-console-probe/node_modules/lines-js/lib/lines.js:142:38
    at Array.map (<anonymous>)
    at /home/grant/node-console-probe/node_modules/lines-js/lib/lines.js:134:23
    at Array.map (<anonymous>)
    at Lines.toString (/home/grant/node-console-probe/node_modules/lines-js/lib/lines.js:133:27)
    at Object.<anonymous> (/home/grant/node-console-probe/console-probe.js:32:15)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
@couchand
Copy link
Owner

Oh wow, thanks for finding this! It looks like ansi-styles chose to unpublish version 2.2.0, which is what I'd developed against here (see chalk/ansi-styles#15 (comment))

Upgrading to 3 fixes it, so I'll publish a new version now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants