Consider the following code:
package main
import (
"fmt"
"github.com/fatih/color"
)
func main() {
a := color.New(color.FgRed).SprintFunc()("aaa")
b := color.New(color.FgBlue).SprintFunc()("bbb")
c := color.New(color.Underline).SprintFunc()(a + b)
fmt.Println(c)
d := color.New(color.Underline).SprintFunc()("aaabbb")
fmt.Println(d)
}

I would expect the Underline to apply to the whole colorized string.
This is adapted of how I use it in
The issue seems to come from the usage of wrap in https://github.com/fatih/color/blob/main/color.go#L353-L357. It seems that unformat resets the entire format, not just the colors.
Is this expected?
If so, which approach would you recommend to make a colorized string fully underlined?
Thanks!
Consider the following code:
I would expect the
Underlineto apply to the whole colorized string.This is adapted of how I use it in
The issue seems to come from the usage of
wrapin https://github.com/fatih/color/blob/main/color.go#L353-L357. It seems thatunformatresets the entire format, not just the colors.Is this expected?
If so, which approach would you recommend to make a colorized string fully underlined?
Thanks!