Updated splash screen (ANSI art, CP437)
This commit is contained in:
1 parent
ed06492bd0
commit
eb8ecb46c8
5 files changed
+6
-92
No files matched your search
@@ -1,6 +0,0 @@
|
||||
███╗ ███╗███████╗███████╗██╗ ██╗████████╗███████╗██████╗ ███╗ ███╗
|
||||
████╗ ████║██╔════╝██╔════╝██║ ██║╚══██╔══╝██╔════╝██╔══██╗████╗ ████║
|
||||
██╔████╔██║█████╗ ███████╗███████║ ██║ █████╗ ██████╔╝██╔████╔██║
|
||||
██║╚██╔╝██║██╔══╝ ╚════██║██╔══██║ ██║ ██╔══╝ ██╔══██╗██║╚██╔╝██║
|
||||
██║ ╚═╝ ██║███████╗███████║██║ ██║ ██║ ███████╗██║ ██║██║ ╚═╝ ██║
|
||||
╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
|
||||
Binary file not shown.
@@ -1,6 +0,0 @@
|
||||
██╗ ██╗█████╗████╗██╗██╗██████╗█████╗█████╗ ██╗ ██╗
|
||||
███████║██╔══╝██╔═╝██║██║╚═██╔═╝██╔══╝██╔═██╗███████║
|
||||
██╔█╔██║████╗ ████╗█████║ ██║ ████╗ █████╔╝██╔█╔██║
|
||||
██║╚╝██║██╔═╝ ╚═██║██╔██║ ██║ ██╔═╝ ██╔═██╗██║╚╝██║
|
||||
██║ ██║█████╗████║██║██║ ██║ █████╗██║ ██║██║ ██║
|
||||
╚═╝ ╚═╝╚════╝╚═══╝╚═╝╚═╝ ╚═╝ ╚════╝╚═╝ ╚═╝╚═╝ ╚═╝
|
||||
+6
-7
@@ -2,18 +2,17 @@
|
||||
|
||||
The art itself lives in ``meshterm/assets`` as pre-coloured ``.ans`` files — the classic
|
||||
ANSI-art extension, kept short because the editors that draw this stuff are old and
|
||||
particular about 8.3 names. A ``.txt`` beside one is its hand-drawn source for marks we
|
||||
colour ourselves (``scripts/colour-logo.py`` paints one into the other); a mark drawn in
|
||||
an ANSI-art editor arrives already finished and has no source but itself. Files are read
|
||||
fresh on every call, so the wordmark can be re-styled by editing the art alone: no code
|
||||
change and no restart of the design loop.
|
||||
particular about 8.3 names. Each mark is drawn by hand in one of those editors and needs
|
||||
no source but itself: there is nothing here that generates a wordmark, and nothing to
|
||||
re-run after editing one. Files are read fresh on every call, so the mark can be re-styled
|
||||
by editing the art alone: no code change and no restart of the design loop.
|
||||
|
||||
Three things separate a real ``.ans`` from a text file with colour in it, and :func:`_rows`
|
||||
handles them all so the art stays authorable in the tools that drew it:
|
||||
|
||||
* **Codepage 437.** The blocks and box-drawing (``█▓▒░`` and ``╔═╗``) are single bytes in
|
||||
DOS's codepage, not UTF-8. We try UTF-8 first and fall back, so a mark we generated
|
||||
ourselves and a mark exported from an art editor both read.
|
||||
DOS's codepage, not UTF-8. We try UTF-8 first and fall back, so an older mark stored as
|
||||
UTF-8 (the 53-column one still is) and one exported from an art editor both read.
|
||||
* **Auto-wrap.** An art editor omits the line break on a row that fills the canvas and
|
||||
lets the terminal wrap it, so the file's newlines are *not* the picture's rows. The
|
||||
canvas width comes from the SAUCE record on the end of the file — which has to be
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Colour a plain-text wordmark into the pre-coloured ANSI the splash draws.
|
||||
|
||||
The art itself is hand-drawn and lives in ``meshterm/assets`` as a ``.txt``; this paints
|
||||
it and writes the matching ``.ans`` beside it, so the colour scheme is stated once here
|
||||
rather than re-typed into every escape sequence by hand.
|
||||
|
||||
python scripts/colour-logo.py # repaint every asset/*.txt
|
||||
python scripts/colour-logo.py logo_53 # just that one
|
||||
|
||||
The scheme is a vertical ramp over the letter rows — white, yellow, light red, red, light
|
||||
black, hottest at the top — with every box-drawing character (the drop shadow and the
|
||||
letters' own bevels) in the light black regardless of its row. Each colour is chosen so the
|
||||
PicoCalc console's 16-slot quantizer lands it on exactly one palette slot (15, 11, 9, 1, 8)
|
||||
while it stays a warm fade in truecolour on the desktop; see ``theme._VT_SLOTS``.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ASSETS = Path(__file__).resolve().parent.parent / "meshterm" / "assets"
|
||||
|
||||
#: Letter-row colours, hottest first. A mark with more rows than this reuses the last one.
|
||||
ROW_RGB = ("255;255;255", "251;217;80", "248;113;113", "185;28;28", "80;93;111")
|
||||
|
||||
#: Every non-block character — the drop shadow and the bevels — takes this.
|
||||
SHADOW_RGB = "80;93;111"
|
||||
|
||||
#: The letter body. Everything else in the art is shadow.
|
||||
BLOCK = "█"
|
||||
|
||||
|
||||
def colour(art: str) -> str:
|
||||
"""Paint one plain-text wordmark, returning the pre-coloured ANSI."""
|
||||
lines = art.split("\n")
|
||||
if lines and lines[-1] == "":
|
||||
lines.pop()
|
||||
out_lines = []
|
||||
for row, line in enumerate(lines):
|
||||
hue = ROW_RGB[min(row, len(ROW_RGB) - 1)]
|
||||
out, current = [], None
|
||||
for ch in line:
|
||||
if ch == " ":
|
||||
if current is not None:
|
||||
out.append("\x1b[0m")
|
||||
current = None
|
||||
out.append(" ")
|
||||
continue
|
||||
want = hue if ch == BLOCK else SHADOW_RGB
|
||||
if want != current:
|
||||
out.append(f"\x1b[38;2;{want}m")
|
||||
current = want
|
||||
out.append(ch)
|
||||
if current is not None:
|
||||
out.append("\x1b[0m")
|
||||
out_lines.append("".join(out))
|
||||
return "\n".join(out_lines) + "\n"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Repaint the named marks, or every ``.txt`` in the assets folder."""
|
||||
names = sys.argv[1:] or sorted(p.stem for p in ASSETS.glob("*.txt"))
|
||||
for name in names:
|
||||
source = ASSETS / f"{name}.txt"
|
||||
target = ASSETS / f"{name}.ans"
|
||||
target.write_text(colour(source.read_text(encoding="utf-8")), encoding="utf-8")
|
||||
print(f"{source.name} -> {target.name}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user