You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to be able to concatenate two strings with different foreground colors, but not have termenv insert the reset sequence in between.
The reset sequence prevents the ability to set a shared background for the strings without setting a bg on both strings individually.
My use case is a custom table component I implemented.
When a row is selected, I apply a background on the entire row, but the bg is only applied on the first string, because of the reset sequence.
This is the raw string:
'\x1B[41m\x1B[38;5;245m#158\x1B[0m\x1B[38;5;245mDifferentiate draft PRs from open PRs\x1B[0m\x1B[0m'
Which is the result of calling:
prNumber:=lipgloss.NewStyle().Foreground("<some fg>").Render("#158")
title:=lipgloss.NewStyle().Foreground("<some other fg>").Render("Differentiate draft PRs from open PRs")
lipgloss.NewStyle().Background(lipgloss.Color("1")).
Render(fmt.Sprintf("%s%s", prNumber, title))
What have I tried
Using lipgloss.JoinHorizontal yields the same results
I can always do prNumber = strings.Replace(prNumber, "\x1b[0", "", -1) which works but feels hacky as it relies on the escape sequence encoding termenv is using.
Possible solution
Maybe provide a PreventReset() method on the lipgloss.Style?
The text was updated successfully, but these errors were encountered:
I want to be able to concatenate two strings with different foreground colors, but not have
termenv
insert the reset sequence in between.The reset sequence prevents the ability to set a shared background for the strings without setting a bg on both strings individually.
My use case is a custom table component I implemented.
When a row is selected, I apply a background on the entire row, but the bg is only applied on the first string, because of the reset sequence.
This is the raw string:
Which is the result of calling:
What have I tried
lipgloss.JoinHorizontal
yields the same resultsprNumber = strings.Replace(prNumber, "\x1b[0", "", -1)
which works but feels hacky as it relies on the escape sequence encodingtermenv
is using.Possible solution
Maybe provide a
PreventReset()
method on thelipgloss.Style
?The text was updated successfully, but these errors were encountered: