Files
MeshTerm/meshterm/ui/logo.py
T
Jean-Pierre MartineauandClaude Opus 4.8 e52e5daf87 Draw the splash wordmark from a colored logo.ansi file
Replace the baked-in block-glyph constant with a pre-coloured logo.ansi read
fresh on every render, so the wordmark can be re-styled by editing that file
alone. It uses the ANSI Shadow face with green letters (#4ade80) and a
single-line dark-green bevel (#166534).

The banner path in compose_startup now centers already-coloured ANSI rows (as
one left-aligned block) rather than force-styling them a single colour, and a
new muted, centered footnote sits below the box — the splash uses it for a
"© <year> Homestead" copyright notice. The plain-text source is kept as
logo.txt for regenerating the art, and the old ansilogo.txt is removed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 17:32:38 -04:00

31 lines
1.1 KiB
Python

"""The MeshTerm wordmark for the startup splash, loaded from ``logo.ansi``.
The art lives in a sibling ``logo.ansi`` file (pre-coloured ANSI, one row per line) and is
read fresh on every call, so the wordmark can be re-styled by editing that file alone — no
code change or restart of the design loop required.
"""
from __future__ import annotations
from pathlib import Path
#: The ANSI art file, kept beside this module so it ships inside the package.
_LOGO_PATH = Path(__file__).with_name("logo.ansi")
def load_logo() -> list[str]:
"""Return the wordmark's rows (pre-coloured ANSI strings), or ``[]`` if unavailable.
Read from :data:`_LOGO_PATH` on each call so an edit to the art is picked up without a
restart. A missing or unreadable file degrades to no banner rather than raising, so the
splash still works.
"""
try:
text = _LOGO_PATH.read_text(encoding="utf-8")
except OSError:
return []
lines = text.split("\n")
if lines and lines[-1] == "": # drop the trailing newline's empty row
lines.pop()
return lines