gum/internal/utils/utils.go
Carlos Alexandro Becker e069590209
feat!: v2
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2025-03-27 14:22:22 -03:00

15 lines
345 B
Go

package utils
import (
"strings"
"github.com/charmbracelet/lipgloss/v2"
)
// 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
}