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

Expose colorable Stderr to use as writer #87

Merged
merged 1 commit into from
May 15, 2018

Conversation

achilleas-k
Copy link
Contributor

Since printing colors on Windows requires defining the colorised writer (fmt.Fprint(color.Output, ...)), this PR exposes the equivalent colorised Stderr writer. So the following would be supported:

var green = color.New(color.FgGreen).SprintFunc()
var red = color.New(color.FgRed).SprintFunc()

fmt.Fprintln(color.Output, green("This is normal green text")) // Prints to os.Stdout
fmt.Fprintln(color.Output, red("This is normal red text")) // Prints to os.Stdout
fmt.Fprintln(color.Error, red("This is error red text"))  // Prints to os.Stderr

tzdybal added a commit to tzdybal/go-ethereum that referenced this pull request Apr 25, 2018
solution: temporary switch to forked branch with proposed PR
with code that we require. After fatih/color#87
is merged, we can switch to original repository.
@fatih fatih merged commit 5b77d2a into fatih:master May 15, 2018
@fatih
Copy link
Owner

fatih commented May 15, 2018

Thanks @achilleas-k

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

Successfully merging this pull request may close these issues.

2 participants