fatih / color

Color package for Go (golang)
https://pkg.go.dev/github.com/fatih/color
MIT License
7.24k stars 615 forks source link

Anyway to print without it always being on a new line? #103

Closed jsiciliano closed 5 years ago

jsiciliano commented 6 years ago

It looks like the source code uses fmt.Println for everything, but what if I want things to be on the same line just in a different print statement. For example, if I wanted to use two colors on the same line.

How would I do this? Or do I have to edit the source file?

Thanks!

jhollowayj commented 6 years ago

Check out this section of the readme. https://github.com/fatih/color/blob/master/README.md#insert-into-noncolor-strings-sprintfunc

farzadsalim commented 5 years ago

It seems this fails on Win10. I'm building on Mac with [build] constraints to compile for Windows/Linux/Darwin. With the followings Main_win.go yellow = color.New(color.FgYellow).SprintFunc() Main.go

       var yellow func(a ...interface{}) string
        fmt.Printf(" %s \n", yellow("test")) 

Stdout > test

fatih commented 5 years ago

Hi,

Unfortunately, I'm archiving this project and will no longer maintaining it. For more information, please read my blog post: Taking an indefinite sabbatical from my projects.

Thanks for the feedback and contribution.