Open ayala-orca opened 2 weeks ago
What is the color
library you are using?
What is the
color
library you are using?
Found the issue, and a workaround.
Issue is because fatih/color library uses \x1b0;22m
to turn off Bold, and that is not a widely supported instruction, and my text library fails to parse it correctly.
Workaround: Use this:
fmt.Sprintf("%s %s",
color.New(color.FgHiRed, color.Bold).Sprint("Bold Title"),
color.New(color.FgHiRed).Sprint("This line should be colored in red"),
),
instead of:
color.New(color.FgHiRed).Sprintf("%s %s", color.New(color.Bold).Sprint("Bold Title"), "This line should be colored in red"),
I'll see what I can do to handle this case without the workaround.
Describe the bug When using the table library to format text with by setting
text.WrapText
andWidthMax
, if the text contains both color and bold formatting, the text wrapping breaks the color configuration. Only the first line is colored as expected.To Reproduce Run the following code
Expected behavior The text should retain the color formatting even after being wrapped to the next line.
Screenshots As shown in the second column - the color configuration is broken when the text wrapping occurs.
Software (please complete the following information):