-
Notifications
You must be signed in to change notification settings - Fork 57
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
Switch to no-op methods when not writing to a terminal (control chars) #27
Comments
I see this: but it would be much better if there was an env var instead of just a flag |
Tell me if this looks good? It might be good for the readme: package au
import (
"os"
"github.com/logrusorgru/aurora/v4"
)
var colors = os.Getenv("my_app_with_color")
var hasColor = colors != "no"
var Col = aurora.New(aurora.WithColors(hasColor)) |
package au
import (
"os"
"github.com/logrusorgru/aurora/v4"
)
var au = aurora.New(aurora.WithColors(os.Getenv("COLORS") != "")) ? to aviod some variables in global namespace |
Also, there's a way to autodetect a terminal & choose color mode -- #2 (comment) |
A lot of software supports disabling colors via the |
great lib!
is there a switch (env var) that can noop methods so we don't get control chars?
Control chars seem to be good for displaying to terminal, but when we are writing to a non-terminal (a pipe for example) I want to noop the colors so I don't get control chars etc.
The text was updated successfully, but these errors were encountered: