Files
fn_registry/functions/tui/load_ascii_art.md
T
egutierrez 47fac22230 chore: auto-commit (799 archivos)
- .claude/CLAUDE.md
- .claude/commands/subagentes.md
- .claude/rules/INDEX.md
- .mcp.json
- bash/functions/cybersecurity/analyze_dns.md
- bash/functions/cybersecurity/audit_http_headers.md
- bash/functions/cybersecurity/audit_ssh_config.md
- bash/functions/cybersecurity/check_firewall.md
- bash/functions/cybersecurity/detect_suspicious_users.md
- bash/functions/cybersecurity/encrypt_file.md
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 00:28:20 +02:00

55 lines
1.8 KiB
Markdown

---
name: load_ascii_art
kind: function
lang: go
domain: tui
version: "1.0.0"
purity: impure
signature: "func LoadASCIIArt(staticPath string, colors []lipgloss.Color) string"
description: "Lee un archivo .txt aleatorio de un directorio y lo renderiza con degradado de colores. Util para headers de TUIs con ASCII art variado."
tags: [tui, ascii, art, header, gradient, random, file, pendiente-usar]
uses_functions: [apply_gradient_go_tui]
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: [bufio, math/rand, os, path/filepath, strings, time, github.com/charmbracelet/lipgloss]
params:
- name: staticPath
desc: "directorio con archivos .txt de ASCII art"
- name: colors
desc: "paleta de colores para el degradado; nil usa DefaultGradientColors"
output: "string con ASCII art coloreado, o vacio si no hay archivos o hay error"
tested: false
tests: []
test_file_path: ""
file_path: "functions/tui/load_ascii_art.go"
source_repo: "https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/egutierrez/DevLauncher.git"
source_license: "MIT"
source_file: "launcher/middleware/assets.go"
---
## Ejemplo
```go
// Cada app pone sus archivos .txt en un directorio static/
header := tui.LoadASCIIArt("./static", nil)
if header != "" {
fmt.Print(header)
}
// Con paleta custom
palette := []lipgloss.Color{
lipgloss.Color("#ff6b6b"),
lipgloss.Color("#feca57"),
lipgloss.Color("#48dbfb"),
}
header = tui.LoadASCIIArt("./static", palette)
```
## Notas
Patron de uso: cada app TUI mantiene un directorio `static/` con archivos `.txt` de ASCII art. Al iniciar, `LoadASCIIArt` elige uno al azar y le aplica el degradado de colores. Esto da variedad visual en cada ejecucion.
Fallback silencioso: si el directorio no existe, no tiene .txt, o hay error de lectura, retorna "" sin error. El caller decide si mostrar un fallback.