We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Env: OS: windows 10 go: 1.17.2 bash: cmd powershell gitbash
package main import ( "fmt" "github.com/fatih/color" "io" "text/tabwriter" ) func main() { tabOut := getTabOutWithWriter(color.Output) fmt.Fprint(tabOut, "\x1b[0;32m demo\t\tStart the server\n\x1b[0m") fmt.Fprint(tabOut, "\x1b[0;32m help\t\tHelp about any command\n\x1b[0m") fmt.Fprint(tabOut, "\x1b[0;32m server:start\t\tStart the server\n\x1b[0m") tabOut.Flush() } func getTabOutWithWriter(writer io.Writer) *tabwriter.Writer { aTabOut := new(tabwriter.Writer) aTabOut.Init(writer, 0, 8, 1, '\t', 0) return aTabOut }
Output:
demo Start the server help Help about any command server:start Start the server
The text was updated successfully, but these errors were encountered:
Just ran into the same thing, did you end up solving it?
I tried both color.RedString and color.New(color.FgRed).SprintFunc() with no luck...
color.RedString
color.New(color.FgRed).SprintFunc()
Before using color:
After:
Edit: I think this is actually a text/tabwriter problem because the same issue when just using color codes directly:
text/tabwriter
colorReset := "\033[0m" colorRed := "\033[31m" colorGreen := "\033[32m" colorYellow := "\033[33m"
Sorry, something went wrong.
for me this fix works
w.Init(os.Stdout, 0, 8, 4, ' ', 0)
No branches or pull requests
Env:
OS: windows 10
go: 1.17.2
bash: cmd powershell gitbash
Output:
The text was updated successfully, but these errors were encountered: