Comments (9)
How would you pass --color
in the browser?
from supports-color.
Even though chrome console, for instance, does support ansi-color.
Line 3 in 4f459ee
from supports-color.
How would you pass --color in the browser?
There isn't any, that's exactly what I meant.
Even though chrome console, for instance, does support ansi-color.
Hmm, indeed, however I still got no color for some reason (maybe 'basic' was not enough for the library I was using, not sure).
Anyway, it would be nice if FORCE_COLOR
would force color even in the browser; using env variable seems better than monkye-patching.
from supports-color.
@sindresorhus we should make sure we're not bumping up against this: https://blog.chromium.org/2021/05/update-on-user-agent-string-reduction.html
@roman-khazanskii could you paste here the value of navigator.userAgent
from your browser?
from supports-color.
@Qix- sure - 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.113 Safari/537.36'
But I'm afraid you are missing my original point. I didn't actually need colors in my browser console, I wanted to transform ANSI-colored string to HTML (even though my browser console did support color as well, these things are not connected).
from supports-color.
I have no idea what you're asking, then. This library doesn't do that, and none of chalk's code outputs HTML.
from supports-color.
I have no idea what you're asking, then. This library doesn't do that, and none of chalk's code outputs HTML.
I know! I just want a way to force color support, that's all :) So other library will give me ANSI-colored text and then I will transform it to HTML.
Sorry if I'm not being very clear from the beginning; I just want to force-enable color support, even in the browser.
from supports-color.
I'm bumping into this now —
chalk.supportsColor
is returning false in v4.1.2 in Chrome 103.0.5060.134, and is subsequently not coloring any of the text.
But creating a new custom instance that forces color support with const customChalk = new chalk.Instance({level: 3});
does indeed output colored text.
User agent is Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
for me, which makes isBlinkBasedBrowser
return true.
from supports-color.
Ah, I'm now seeing that Chalk v4 is using supports-color v7, which explicitly disables browser color support in browser.js
.
from supports-color.
Related Issues (20)
- Implementing the NO_COLOR environment variable standard HOT 1
- support for NO_COLOR env var HOT 5
- False-negative on GitHub Actions HOT 22
- What is wrong with the native `writeStream.getColorDepth`? HOT 3
- How to force using colors from browser? HOT 1
- Broken build with rollup for node due to global "navigator" HOT 6
- supportsColor() should recheck process.env.FORCE_COLOR HOT 2
- Change to ESM causes backwards compatibility issues HOT 3
- Implement `NO_COLOR` informal specification HOT 1
- "Can't resolve node:tty" when using nextjs and yarn 3 HOT 1
- `navigator.userAgentData` HOT 1
- Support importing via deno HOT 3
- GitHub Action support truecolor HOT 1
- SyntaxError in index.js HOT 2
- My terminal emulator (mobaxterm) supports truecolor, but supports-color doesn't detect it HOT 4
- Package published without README HOT 1
- Claimed support for Node.js v12 missing HOT 10
- process is not defined in supports-colors.js HOT 1
- `FORCE_COLOR` testcases failing (fixed 2) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from supports-color.