-
When aplying a style with background, it doesn't fill some whitespace after a colored text. example: package main
import (
"fmt"
"strings"
"github.com/charmbracelet/lipgloss"
)
var (
box = lipgloss.NewStyle().
Background(lipgloss.Color("237")).
Padding(2)
label = lipgloss.NewStyle().
Foreground(lipgloss.Color("6"))
text = lipgloss.NewStyle().
Foreground(lipgloss.Color("9"))
)
func main() {
var col1, col2 strings.Builder
col1.WriteString(label.Render("foo:"))
col1.WriteRune('\n')
col1.WriteString(label.Render("bar:"))
col2.WriteString(text.Render("1235"))
col2.WriteRune('\n')
col2.WriteString(text.Render("ABC"))
fmt.Println(
box.Render(
lipgloss.JoinHorizontal(
lipgloss.Bottom,
col1.String(),
lipgloss.NewStyle().PaddingLeft(5).Render(col2.String()),
),
),
)
} |
Beta Was this translation helpful? Give feedback.
Answered by
bashbunni
Jul 20, 2022
Replies: 1 comment
-
Are you hoping to see more of the darker background right of "1235" and "ABC"? Let me know if that makes sense. I'm happy to answer any questions that pop up! |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
bashbunni
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are you hoping to see more of the darker background right of "1235" and "ABC"?
If so, I would use Lipgloss'
Padding
orPaddingRight
functions to tailor the padding to your liking.Let me know if that makes sense. I'm happy to answer any questions that pop up!