Is there a way to clear the set color string?
Like0x opened this issue · 1 comments
Like0x commented
Is there a way to clear the set color string?
I used color in other places, but I just want to clear the color in the specified place.
Yellow = color.New(color.FgYellow).SprintFunc()
s := Yellow(str)
// clear color s ?
I don't want to turn off the color globally.
var flagNoColor = flag.Bool("no-color", false, "Disable color output")
if *flagNoColor {
color.NoColor = true // disables colorized output
}
Is there any code to do that?
fatih commented
Yeah create your color instance first before using SprintFunc()
and then you can disable it via DisableColor()
, see: https://github.com/fatih/color#disableenable-color