-
Notifications
You must be signed in to change notification settings - Fork 28.6k
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
util: use magenta;bold #14359
util: use magenta;bold #14359
Conversation
* Default Powershell on Windows setting remap ANSI magenta to the color of the background
Apparently this is not tested IMHO it should. |
Doesn't this change affect non-Windows too? This color will now stand out like a sore thumb compared to the others since none of the others are bolded? I'm not sure that is a good idea... |
Have Microsoft said they're not willing to change the default anywhere? |
I'm not sure either... Looking for feedback... |
This wierdsnes was intentional PowerShell/PowerShell#4266 (comment), and is not directly part of Powershell, but is part of the deatult user setting. |
I think I'm -1 on doing this, especially for all platforms. On some terminals the difference between normal and bold is pretty pronounced, and bold is normally used to highlight things. Is there a way to just do it for Windows? I also somewhat agree with @bnoordhuis's point in #14243 (comment)
so I'd like to be sure that Microsoft have 0 intention of fixing this (!!!) before we do this. |
Also would like to see this only applied on Windows, boldening just one color would be inconsistent on other platforms (And I personally dislike the bold style in Mintty so much that I'm maintaining a fork of it that disables bold styles). |
@nodejs/platform-windows @Fishrock123 @addaleax Do we actually want this? tl;drOn windows the default shortcut that launches the Powershell console, remaps ANSI color 35 (magenta) and uses it as the background. |
Made it so require('util').inspect.styles.date = 'yellow' // Or whatever |
BTW, this will still affect alternate terminals (hyper, mintty, console2, ...) on Windows. Maybe a better fix would be to detect PS, maybe through a environment variable? |
// Magenta has problems with the deafult configuration of Powershell | ||
// Ref: https://github.com/nodejs/node/issues/14243 | ||
if (process.platform === 'win32') | ||
inspect.styles.date = 'magenta;bold'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work for anything the user logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are logs a problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm saying a proper "fix" would be to intercept any write to stdout and replace the non-bold sequence with the bold one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OTOH, such an rewrite of colors can be considered breaking. Probably better to not go that route and instead make sure we don't print that magenta, and maybe that modules like chalk workaround it until PS fixes it.
I don't see anything obvious to gate on: |
Hmm yeah, probably can't distinguish PS from cmd by environment alone, thought it might not be too bad to go off Overall, I'm strongly feeling that this is better fixed on PowerShell's side, or at least users should be instructed to change the default colors. |
FWIW I found a tiny change; |
Ping @refack |
@@ -242,6 +243,10 @@ inspect.styles = Object.assign(Object.create(null), { | |||
// "name": intentionally not styling | |||
'regexp': 'red' | |||
}); | |||
// Magenta has problems with the deafult configuration of Powershell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo deafult
So I see two routes forward here:
|
Closing in favor of manual |
ANSI magenta to the color of the background
Microsoft will not/can not change the palette remapping on all installed instances of Windows, but we can use magenta;bold instead of regular magenta 🤷♂️
Fixes: #14243
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
repl,util