gum/internal/utils/utils.go
2023-05-18 12:26:33 -04:00

16 lines
342 B
Go

package utils
import (
"strings"
"github.com/charmbracelet/lipgloss"
)
// LipglossPadding calculates how much padding a string is given by a style.
func LipglossPadding(style lipgloss.Style) (int, int) {
render := style.Render(" ")
before := strings.Index(render, " ")
after := len(render) - len(" ") - before
return before, after
}