Files
egutierrez ebba1e4e02 feat: add Go TUI rendering and terminal helper functions
7 funciones Go del dominio tui: apply_gradient (gradiente de color en texto),
draw_box y draw_separator (renderizado de cajas y separadores con box_chars),
load_ascii_art (carga de arte ASCII desde archivos), normalize_terminal_output
y strip_ansi (limpieza de salida de terminal), read_dir_autocomplete
(autocompletado de rutas de directorio). Incluye box_chars.go como helper
de caracteres Unicode para bordes.
2026-04-12 13:54:54 +02:00

15 lines
493 B
Go

package tui
import "github.com/charmbracelet/lipgloss"
// DrawBox draws a Unicode box around content with the given width and style.
func DrawBox(content string, width int, style lipgloss.Style) string {
fill := lipgloss.NewStyle().Render(
lipgloss.PlaceHorizontal(width-2, lipgloss.Left, BoxH, lipgloss.WithWhitespaceChars(BoxH)),
)
topLine := style.Render(BoxTL + fill + BoxTR)
bottomLine := style.Render(BoxBL + fill + BoxBR)
return topLine + "\n" + content + "\n" + bottomLine
}