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

Align FORCE_COLOR=0 with Node.js meaning #62

Open
nicolo-ribaudo opened this issue Mar 19, 2024 · 2 comments
Open

Align FORCE_COLOR=0 with Node.js meaning #62

nicolo-ribaudo opened this issue Mar 19, 2024 · 2 comments

Comments

@nicolo-ribaudo
Copy link

Node.js allows disabling color by passing FORCE_COLOR=0 (https://nodejs.org/api/tty.html#writestreamgetcolordepthenv). Would you be open to a PR checking if FORCE_COLOR is 0?

For context, we just migrated Babel from Chalk to picocolors and found this difference. For now we are going to roll our own color detection logic to preserve the Node.js-like behavior.

@alexeyraspopov
Copy link
Owner

I'm considering switch to https://nodejs.org/api/tty.html#writestreamhascolorscount-env that seems to be available since Node.js v10.16. I will try to find some tests to see how it works with FORCE_COLOR variable and will make sure too keep this behavior in mind. There's probably a small patch I can make in the meantime for v1 to avoid breaking changes.

@nicolo-ribaudo
Copy link
Author

image

For what is worth, I tried running a totally unscientific poll on Twitter and it seems like people are split on the behavior of FORCE_COLOR=0. While I still think that it's good for Node.js libraries to align with Node.js, changing what FORCE_COLOR=0 does should probably be considered a breaking change.

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