-
-
Notifications
You must be signed in to change notification settings - Fork 857
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
Browser support? #1
Comments
lol no, sorry, this won't be a bloated mess like colors.js. |
That's what I figured, just thought I'd check before starting my own repo. |
Such a disappointment. @danielchatfield did you manage to make your own repo or find that has a similar api with browser support? |
Just curious. Why would you need it for the browser? What's the usecase? |
As you know webkit supports colors in console logging. The syntax is painful though. Instead of The ability to create styles for different modules in client-side single pagers would be helpful. |
It would be great to have it pump out Firebug and Webkit compatible styles, but HTML styles would be great too. Libs like this can bridge the gap: https://github.com/hansifer/ConsoleFlair. |
I ran across an extremely uncommon use case for this at work and got it working pretty easily with browserify and setting |
@callmehiphop Did you do something similar to the following:
Admittedly it's overkill, but that's the only way I could get it to work with browserify. |
For my usecase of displaying colored error messages in-browser, ansi-html seems to work well. |
I'd like to use it (Ora spinners) with xterm.js in the browser. ^_^ |
My awful solution for now: const isNode = typeof process === "object" && `${process}` === "[object process]";
function log(logger, color, label, message) {
if (isNode) {
logger(
chalk
.bgHex(color)
.hex("#FFFFFF")
.bold(` ${label} `),
`${message}`
);
} else {
logger(
`%c ${label} %c ${message}`,
`background-color: ${color}; color: #FFFFFF`,
`background-color: inherit; color: inherit`
);
}
} EDIT: I just turned this into a project: Hagen — the colorful logger |
There are a variety of solutions to this problem (using Chalk in the browser), most of them kind of messy and entirely out of scope for this project. Locking as such. |
Please see #300 |
Are there plans for browser support, like colors has?
The text was updated successfully, but these errors were encountered: