Closed HaloWang closed 6 years ago
hello, I have used this library with WebStorm. The WebStorm terminal should work. What version are you using?
Thanks, The latest version of color.js Yes, it work in WS - terminal tab. But not 'Run' tab š°
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?
@simonhochrein š It's not a theme, just search "antialiasing" and "override default fonts" in the preferences of WebStorm.
OHH ok thanks! :smiley:
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:
Remote Interpreter:
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 :(
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:
Then click ... next to the Environment variables section:
Then click +
Define a new variable called "ALLOW_COLORS" and set the value to true:
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.
@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
@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 :(
@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
@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!
I was having issues with different terminals with this module also with WebStorm's terminal. To solve them you need to do two things:
colors
execute code
process.stdout.isTTY = true
require('colors').enabled = true
Specifically WebStorm requires second thing. For example Windows Git-Bash requires first
@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.
This project works fine in run tab of Webstorm: https://github.com/medikoo/cli-color
@Alexsey, thanks, that helped
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!
@DABH it works! I've tested it in PHPStorm, should work in WebStorm too.
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.
How can I make color.js enable in WebStorm?