themes-terminal/ascii_header.templ
Alex Dunmow 0a9b177f7c initial: theme plugin terminal
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/terminal.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-06 14:11:44 +08:00

41 lines
1.0 KiB
Plaintext

package main
// figletBanner returns a small block-letter banner for the given title.
// This is intentionally simple — admins who want bespoke figlet output can
// paste it into the asciiArt field which overrides this.
func figletBanner(title string) string {
if title == "" {
return ""
}
return "/*===========================================*/\n" +
"/* " + padRight(title, 41) + " */\n" +
"/*===========================================*/"
}
// padRight pads s with spaces on the right so the total length is at least n.
func padRight(s string, n int) string {
for len(s) < n {
s = s + " "
}
if len(s) > n {
s = s[:n]
}
return s
}
templ asciiHeaderComponent(data AsciiHeaderData) {
<div class="ascii-header" data-block="terminal:ascii_header">
if data.AsciiArt != "" {
<pre>{ data.AsciiArt }</pre>
} else {
<pre>{ figletBanner(data.Title) }</pre>
}
<div class="prompt-line">
<span class="terminal-mono">{ data.Prompt }</span>
if data.Title != "" {
<span class="terminal-mono">{ data.Title }</span>
}
</div>
</div>
}