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
amills-vibeirl
changed the title
Switch to no-op methods when not-writing to a terminal (control chars)
Switch to no-op methods when not writing to a terminal (control chars)
Dec 25, 2023
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: