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

Foreground Magenta is not shown well in powershell(windows) #14243

Closed
yyjdelete opened this issue Jul 15, 2017 · 10 comments
Closed

Foreground Magenta is not shown well in powershell(windows) #14243

yyjdelete opened this issue Jul 15, 2017 · 10 comments
Labels
windows Issues and PRs related to the Windows platform.

Comments

@yyjdelete
Copy link

  • Version:6.9.5, 8.1.4
  • Platform:Windows 10 x64(16241 and some old versions)
  • Subsystem:

Foreground Magenta is shown as blue(the default background) in power shell, so it make the output
totally unreadable.
Not sure if it's a bug of windows, since powershell is now the default console in windows instead of cmd, could someone make an fix for this or reported to Microsoft?

Run on an new powershell(Not run powershell on cmd), found something magenta is not shown, but can be copy.

  1. Test 1(node/REPL)
node
> new Date()

image

The output is not shown.
2. Test 2(npm)
npm outdate -g(make sure there is some pkgs outdate), and found Latest field is not shown.
image

@vsemozhetbyt vsemozhetbyt added the windows Issues and PRs related to the Windows platform. label Jul 15, 2017
@mscdex
Copy link
Contributor

mscdex commented Jul 15, 2017

For the npm issue, you should post about that on npm's issue tracker since they choose their own color scheme.

@tniessen
Copy link
Member

I can confirm this is an issue, but I am not sure what the proper fix is... There is only a limited number of colors and some other terminal might use another color as the default background, and so on.

You can use SET NODE_DISABLE_COLORS=1 before executing node to prevent this for the repl.

@refack
Copy link
Contributor

refack commented Jul 16, 2017

IMHO the bug is that magenta is mapped to #012456. When the BG is black it's Ok:
image

@refack
Copy link
Contributor

refack commented Jul 16, 2017

even more minimal snippent:

process.stdout.write(`\u001b[35mXXX\u001b[39m`)

image
AFAICT it's a Windows bug, since 35 should be magenta.

@tniessen
Copy link
Member

Ref chalk/chalk#2

@refack
Copy link
Contributor

refack commented Jul 16, 2017

The powershell shortcut remaps magenta and dark yellow.
image

@refack
Copy link
Contributor

refack commented Jul 16, 2017

Cross-Ref PowerShell/PowerShell#4266

@bnoordhuis
Copy link
Member

All node.js (or rather, libuv) does is call SetConsoleTextAttribute with the BACKGROUND_RED and BACKGROUND_BLUE attributes set. It's the responsibility of the console to display that as purple / magenta.

Since this is not a (libuv or node.js) bug and is not under our control I'll go ahead and close this. Perhaps you can file a bug report against powershell.

@refack
Copy link
Contributor

refack commented Aug 5, 2017

FYI: https://blogs.msdn.microsoft.com/commandline/2017/08/02/updating-the-windows-console-colors/
(This does not solve the Powershell issue)

@refack
Copy link
Contributor

refack commented Aug 31, 2017

@yyjdelete FYI after playing around and discussing a possible code level fix, it seems like the simplest solution is to override the default style for dates with a statements similar to

util.inspect.styles.date = 'bold';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants