Files
fn_registry/functions/tui/draw_box.md
T
egutierrez 8bc721d53b 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

48 lines
1.5 KiB
Markdown

---
name: draw_box
kind: function
lang: go
domain: tui
version: "1.0.0"
purity: pure
signature: "func DrawBox(content string, width int, style lipgloss.Style) string"
description: "Dibuja un box unicode (bordes dobles) alrededor de contenido con ancho y estilo lipgloss configurables."
tags: [tui, box, border, unicode, draw, lipgloss]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: [github.com/charmbracelet/lipgloss]
params:
- name: content
desc: "texto interior del box"
- name: width
desc: "ancho total del box en caracteres"
- name: style
desc: "estilo lipgloss para los bordes"
output: "string con el box renderizado (top + content + bottom)"
tested: false
tests: []
test_file_path: ""
file_path: "functions/tui/draw_box.go"
source_repo: "https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/egutierrez/DevLauncher.git"
source_license: "MIT"
source_file: "launcher/ui/styles.go"
---
## Ejemplo
```go
style := lipgloss.NewStyle().Foreground(lipgloss.Color("#00d7ff"))
box := tui.DrawBox(" Hello World ", 40, style)
fmt.Println(box)
// ╔══════════════════════════════════════╗
// Hello World
// ╚══════════════════════════════════════╝
```
## Notas
Usa caracteres de box drawing doble (BoxTL=╔, BoxH=═, etc.) definidos en box_chars.go. El contenido no se recorta ni centra automaticamente — el caller controla el formato interior.