Marak / colors.js

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

Can I use color.js in Webstorm ? #156

Closed HaloWang closed 6 years ago

HaloWang commented 8 years ago

How can I make color.js enable in WebStorm?

simonhochrein commented 8 years ago

hello, I have used this library with WebStorm. The WebStorm terminal should work. What version are you using?

HaloWang commented 8 years ago

Thanks, The latest version of color.js Yes, it work in WS - terminal tab. But not 'Run' tab šŸ˜°

screenshot
simonhochrein commented 8 years ago

I have tested and get the same results... I think that WebStorm only supports highlighting errors in the run tab.. Also, (This is unnecessary) what theme are you using?

HaloWang commented 8 years ago

@simonhochrein šŸ˜‚ It's not a theme, just search "antialiasing" and "override default fonts" in the preferences of WebStorm.

simonhochrein commented 8 years ago

OHH ok thanks! :smiley:

Tomino2112 commented 8 years ago

Something funny is happening in the "Run" tab in jetbrains IDEs. As mentioned above, colors work in console but not in run tab BUT that is when you run your node app locally. If I configure remote node interpreter (from a VM) the colors work in Run tab as well.

Local node interpreter: 2016-05-18_221307

Remote Interpreter: 2016-05-18_221248

Irrelon commented 8 years ago

I created a pull request to fix issues like this in WebStorm and other JetBrains IDE's. https://github.com/Marak/colors.js/pull/150 it hasn't been merged yet though :(

Irrelon commented 8 years ago

I created a new npm module which is EXACTLY the same as colors except it includes my fix for webstorm. You can use it as a drop-in replacement for colors:

npm install irrelon-colors

In webstorm, edit your run configuration:

screen shot 2016-06-20 at 10 45 05

Then click ... next to the Environment variables section:

screen shot 2016-06-20 at 10 46 32

Then click +

screen shot 2016-06-20 at 10 46 56

Define a new variable called "ALLOW_COLORS" and set the value to true:

screen shot 2016-06-20 at 10 47 27

That's it. Now colors will show up when using irrelon-colors as a drop-in replacement for colors.

P.S. I wish I didn't have to make a fork and publish the fork but it's been quite a while since I made the pull request to fix this issue and had no movement on it for some time, so I created irrelon-colors on npm so that I have colorful output until the real repo can merge in the change.

Tomino2112 commented 8 years ago

@Irrelon Great job! Since you didn't need Jetbrain fix, is this more of a colors package fix? Maybe it would be better/faster to create pull request there

Irrelon commented 8 years ago

@Tomino2112 I already created a pull request on colors: https://github.com/Marak/colors.js/pull/150 it was back in February and didn't get a response yet :(

Tomino2112 commented 8 years ago

@Irrelon Ah, sorry, for some reason I thought you created request on webstorm repo... Nothing left to do then, just hope someone will merge it

Irrelon commented 8 years ago

@Tomino2112 Indeed, I really love this package, it's so simple and elegant but it looks a little under-loved recently. I totally understand that keeping a package like this updated and responding to pull requests & issues can be quite time consuming, having my own (relatively) popular package (https://github.com/Irrelon/ForerunnerDB). If the admins are having trouble keeping up or have time constraints, I'm sure that someone else would be able to lend some time to it!

Alexsey commented 8 years ago

I was having issues with different terminals with this module also with WebStorm's terminal. To solve them you need to do two things:

  1. Before loading colors execute code process.stdout.isTTY = true
  2. Require like require('colors').enabled = true

Specifically WebStorm requires second thing. For example Windows Git-Bash requires first

segrey commented 7 years ago

@Marak please update lib/system/supports-colors.js to supports-color >= 1.3.0. That would fix this issue, as colors would be enabled via FORCE_COLOR environment variable which is already specified by WebStorm and other JetBrains IDEs. Another workaround could be to add --colors to Application parameters field in Node.js run configuration.

clouless commented 7 years ago

This project works fine in run tab of Webstorm: https://github.com/medikoo/cli-color

Boorj commented 6 years ago

@Alexsey, thanks, that helped

DABH commented 6 years ago

How does it work now with colors@next? We've updated supports-color, so this should be working now! Would love it if someone could let me know!

ViieeS commented 6 years ago

@DABH it works! I've tested it in PHPStorm, should work in WebStorm too.

DABH commented 6 years ago

Awesome, thanks for checking! Iā€™m going to close this issue has resolved, feel free to open new issue if there are still problems ā€” but seems like we figured this one out.