Skip to content

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

@achilleas-k achilleas-k deleted the expose-colorised-stderr branch August 6, 2025 11:23
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