design-system: six logo candidates + sheet
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file length / file-length (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
Candidates A-F (grid KUHY, K, kuhy wordmark, KY ligature, ringed-K glyph, KR) as flat stroke SVGs in ink and accent, one 40/512 stroke. make_logo_sheet.py validates them and renders the contact sheet at 512/64/16 px in colour, one-colour and inverted. Todo: f75e1003-0 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ -170,3 +170,5 @@ satisfies them — Flutter, web and Python/Tkinter — is in
|
|||||||
app actually uses that status (success/warning/etc.) before adding it.
|
app actually uses that status (success/warning/etc.) before adding it.
|
||||||
- Don't touch `../gatelock` without the production-path verification above;
|
- Don't touch `../gatelock` without the production-path verification above;
|
||||||
a broken import there takes down 3 services at once.
|
a broken import there takes down 3 services at once.
|
||||||
|
|
||||||
|
`logo/` holds the six personal-logo candidates (A-F) and `contact-sheet.png`; regenerate the sheet with `python3 scripts/make_logo_sheet.py` and check one SVG with `python3 scripts/logo_check.py <svg>`.
|
||||||
|
|||||||
9
unified-design-system/logo/a-grid-kuhy.svg
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512">
|
||||||
|
<rect id="field" width="512" height="512" fill="#211D1B"/>
|
||||||
|
<g fill="none" stroke="#B8862E" stroke-width="40" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M116 116V236M216 116L116 176L216 236"/>
|
||||||
|
<path d="M296 116V186A50 50 0 0 0 396 186V116"/>
|
||||||
|
<path d="M116 276V396M216 276V396M116 336H216"/>
|
||||||
|
<path d="M296 276L346 336M396 276L346 336V396"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 475 B |
6
unified-design-system/logo/b-k.svg
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512">
|
||||||
|
<rect id="field" width="512" height="512" fill="#211D1B"/>
|
||||||
|
<g fill="none" stroke="#B8862E" stroke-width="40" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M176 116V396M346 116L176 256L346 396"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 316 B |
9
unified-design-system/logo/c-kuhy-wordmark.svg
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512">
|
||||||
|
<rect id="field" width="512" height="512" fill="#211D1B"/>
|
||||||
|
<g fill="none" stroke="#B8862E" stroke-width="40" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M32 146V326M96 216L32 276L96 326"/>
|
||||||
|
<path d="M160 216V294A32 32 0 0 0 224 294M224 216V326"/>
|
||||||
|
<path d="M288 146V326M288 248A32 32 0 0 1 352 248V326"/>
|
||||||
|
<path d="M416 216L452 306M480 216L430 386"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 483 B |
BIN
unified-design-system/logo/contact-sheet.png
Normal file
|
After Width: | Height: | Size: 251 KiB |
7
unified-design-system/logo/d-ky-ligature.svg
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512">
|
||||||
|
<rect id="field" width="512" height="512" fill="#211D1B"/>
|
||||||
|
<g fill="none" stroke="#B8862E" stroke-width="40" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M156 126V386M376 126L156 296L246 386"/>
|
||||||
|
<path d="M236 126L316 172V386"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 353 B |
7
unified-design-system/logo/e-glyph.svg
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512">
|
||||||
|
<rect id="field" width="512" height="512" fill="#211D1B"/>
|
||||||
|
<g fill="none" stroke="#B8862E" stroke-width="40" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<circle cx="256" cy="256" r="150"/>
|
||||||
|
<path d="M196 119V393M362 150L196 256L362 362"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 356 B |
7
unified-design-system/logo/f-kr.svg
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512">
|
||||||
|
<rect id="field" width="512" height="512" fill="#211D1B"/>
|
||||||
|
<g fill="none" stroke="#B8862E" stroke-width="40" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M116 136V376M226 136L116 256L226 376"/>
|
||||||
|
<path d="M286 376V136H336A60 60 0 0 1 336 256H286M336 256L396 376"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 389 B |
152
unified-design-system/scripts/make_logo_sheet.py
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
"""Build the logo contact sheet from the candidate SVGs in ``logo/``.
|
||||||
|
|
||||||
|
One row per candidate (``a-*.svg`` .. ``f-*.svg``, sorted by name). Columns,
|
||||||
|
left to right: full colour, one-colour, inverted, each at 512, 64 and 16 px
|
||||||
|
true size, centred in a 512 px cell. No labels: row order is file order and
|
||||||
|
column order is fixed, because the sheet is a dev artifact and carries no text.
|
||||||
|
|
||||||
|
Every SVG is validated first, and the sheet is not written if any fails:
|
||||||
|
flat 512 viewBox, an ``id="field"`` background, only ink and accent, one
|
||||||
|
stroke weight, and no gradients, filters, text, fonts, styles or images.
|
||||||
|
|
||||||
|
Run: python3 unified-design-system/scripts/make_logo_sheet.py
|
||||||
|
Exit 0 = sheet written; 1 = no candidates or an invalid SVG.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from logo_check import ACCENT, INK, PAPER, inverted, on_background, one_colour, render
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
LOGO_DIR = Path(__file__).resolve().parents[1] / "logo"
|
||||||
|
STROKE = 40 # the one stroke weight every candidate uses, on a 512 canvas
|
||||||
|
VIEWBOX = "0 0 512 512"
|
||||||
|
SIZES = (512, 64, 16)
|
||||||
|
VARIANTS = ("colour", "one-colour", "inverted")
|
||||||
|
CELL = 512
|
||||||
|
GAP = 32
|
||||||
|
|
||||||
|
BANNED_TAGS = frozenset(
|
||||||
|
{
|
||||||
|
"linearGradient",
|
||||||
|
"radialGradient",
|
||||||
|
"filter",
|
||||||
|
"text",
|
||||||
|
"tspan",
|
||||||
|
"textPath",
|
||||||
|
"font",
|
||||||
|
"font-face",
|
||||||
|
"style",
|
||||||
|
"image",
|
||||||
|
"pattern",
|
||||||
|
"mask",
|
||||||
|
"foreignObject",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
BANNED_ATTRS = frozenset({"filter", "style", "font-family", "font", "class"})
|
||||||
|
ALLOWED_PAINT = frozenset({INK.lower(), ACCENT.lower(), "none"})
|
||||||
|
|
||||||
|
_STROKE_RE = re.compile(r'stroke-width="([^"]+)"')
|
||||||
|
|
||||||
|
|
||||||
|
def _local(name: str) -> str:
|
||||||
|
"""Strip an ``{namespace}`` prefix from an element or attribute name."""
|
||||||
|
return name.rsplit("}", 1)[-1]
|
||||||
|
|
||||||
|
|
||||||
|
def candidates(directory: Path) -> list[Path]:
|
||||||
|
"""Candidate SVGs, sorted by file name (a..f)."""
|
||||||
|
return sorted(directory.glob("*.svg"))
|
||||||
|
|
||||||
|
|
||||||
|
def stroke_widths(svg_text: str) -> set[str]:
|
||||||
|
"""Every distinct ``stroke-width`` value in the SVG."""
|
||||||
|
return set(_STROKE_RE.findall(svg_text))
|
||||||
|
|
||||||
|
|
||||||
|
def problems(svg_text: str) -> list[str]:
|
||||||
|
"""Reasons the SVG breaks the flat-logo rules; empty when it is valid."""
|
||||||
|
try:
|
||||||
|
root = ET.fromstring(svg_text)
|
||||||
|
except ET.ParseError as exc:
|
||||||
|
return [f"not XML: {exc}"]
|
||||||
|
found: list[str] = []
|
||||||
|
if root.get("viewBox") != VIEWBOX:
|
||||||
|
found.append(f"viewBox must be {VIEWBOX!r}")
|
||||||
|
if not any(el.get("id") == "field" for el in root.iter()):
|
||||||
|
found.append('no id="field" background')
|
||||||
|
for el in root.iter():
|
||||||
|
tag = _local(el.tag)
|
||||||
|
if tag in BANNED_TAGS:
|
||||||
|
found.append(f"banned element <{tag}>")
|
||||||
|
for attr, value in el.attrib.items():
|
||||||
|
name = _local(attr)
|
||||||
|
if name in BANNED_ATTRS:
|
||||||
|
found.append(f"banned attribute {name} on <{tag}>")
|
||||||
|
if name in {"fill", "stroke"} and value.lower() not in ALLOWED_PAINT:
|
||||||
|
found.append(f"{name}={value!r} on <{tag}> is not ink or accent")
|
||||||
|
widths = stroke_widths(svg_text) - {str(STROKE)}
|
||||||
|
if widths:
|
||||||
|
found.append(f"stroke-width {sorted(widths)} is not {STROKE}")
|
||||||
|
return found
|
||||||
|
|
||||||
|
|
||||||
|
def variant_text(svg_text: str, variant: str) -> str:
|
||||||
|
"""The SVG source for one column variant."""
|
||||||
|
if variant == "one-colour":
|
||||||
|
return one_colour(svg_text)
|
||||||
|
if variant == "inverted":
|
||||||
|
return inverted(svg_text)
|
||||||
|
return svg_text
|
||||||
|
|
||||||
|
|
||||||
|
def build_sheet(svgs: list[Path]) -> Image.Image:
|
||||||
|
"""Render every candidate in every variant and size into one image."""
|
||||||
|
cols = len(VARIANTS) * len(SIZES)
|
||||||
|
width = cols * CELL + (cols + 1) * GAP
|
||||||
|
height = len(svgs) * CELL + (len(svgs) + 1) * GAP
|
||||||
|
sheet = Image.new("RGB", (width, height), PAPER)
|
||||||
|
for row, svg in enumerate(svgs):
|
||||||
|
source = svg.read_text()
|
||||||
|
top = GAP + row * (CELL + GAP)
|
||||||
|
for v, variant in enumerate(VARIANTS):
|
||||||
|
text = variant_text(source, variant)
|
||||||
|
for s, size in enumerate(SIZES):
|
||||||
|
left = GAP + (v * len(SIZES) + s) * (CELL + GAP)
|
||||||
|
offset = (CELL - size) // 2
|
||||||
|
image = on_background(render(text, size), PAPER)
|
||||||
|
sheet.paste(image, (left + offset, top + offset))
|
||||||
|
return sheet
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv: list[str] | None = None) -> int:
|
||||||
|
"""Validate the candidates, then write the contact sheet PNG."""
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||||
|
parser.add_argument("--dir", type=Path, default=LOGO_DIR)
|
||||||
|
parser.add_argument("--out", type=Path)
|
||||||
|
args = parser.parse_args(argv)
|
||||||
|
svgs = candidates(args.dir)
|
||||||
|
if not svgs:
|
||||||
|
print(f"make_logo_sheet: no SVGs in {args.dir}", file=sys.stderr)
|
||||||
|
return 1
|
||||||
|
bad = {svg.name: problems(svg.read_text()) for svg in svgs}
|
||||||
|
bad = {name: found for name, found in bad.items() if found}
|
||||||
|
for name, found in bad.items():
|
||||||
|
for problem in found:
|
||||||
|
print(f"make_logo_sheet: {name}: {problem}", file=sys.stderr)
|
||||||
|
if bad:
|
||||||
|
return 1
|
||||||
|
out: Path = args.out or args.dir / "contact-sheet.png"
|
||||||
|
build_sheet(svgs).save(out, optimize=True)
|
||||||
|
print(out)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
91
unified-design-system/tests/test_make_logo_sheet.py
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
"""Tests for make_logo_sheet.py: valid flat SVGs in, one contact sheet out."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import shutil
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
Image = pytest.importorskip("PIL.Image")
|
||||||
|
if shutil.which("rsvg-convert") is None: # pragma: no cover - env guard
|
||||||
|
pytest.skip("rsvg-convert not installed", allow_module_level=True)
|
||||||
|
|
||||||
|
import make_logo_sheet
|
||||||
|
|
||||||
|
LOGO_DIR = Path(__file__).resolve().parents[1] / "logo"
|
||||||
|
GOOD = (Path(__file__).parent / "fixtures" / "logo-fixture.svg").read_text()
|
||||||
|
|
||||||
|
|
||||||
|
def test_six_candidates_exist() -> None:
|
||||||
|
names = [p.name[0] for p in make_logo_sheet.candidates(LOGO_DIR)]
|
||||||
|
assert names == list("abcdef")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("svg", sorted(LOGO_DIR.glob("*.svg")), ids=lambda p: p.name)
|
||||||
|
def test_candidate_is_valid_flat_svg(svg: Path) -> None:
|
||||||
|
assert make_logo_sheet.problems(svg.read_text()) == []
|
||||||
|
|
||||||
|
|
||||||
|
def test_one_stroke_weight_across_candidates() -> None:
|
||||||
|
widths = {
|
||||||
|
w
|
||||||
|
for svg in make_logo_sheet.candidates(LOGO_DIR)
|
||||||
|
for w in make_logo_sheet.stroke_widths(svg.read_text())
|
||||||
|
}
|
||||||
|
assert widths == {str(make_logo_sheet.STROKE)}
|
||||||
|
|
||||||
|
|
||||||
|
def test_fixture_is_valid() -> None:
|
||||||
|
assert make_logo_sheet.problems(GOOD) == []
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
("needle", "replacement"),
|
||||||
|
[
|
||||||
|
("<path", '<linearGradient id="g"/><path'),
|
||||||
|
("<path", '<radialGradient id="g"/><path'),
|
||||||
|
("<path", '<filter id="f"/><path'),
|
||||||
|
("<path", "<text>k</text><path"),
|
||||||
|
("<path", '<path font-family="Inter"'),
|
||||||
|
("<path", '<path filter="url(#f)"'),
|
||||||
|
("<path", '<path style="fill:red"'),
|
||||||
|
('stroke="#B8862E"', 'stroke="#FF0000"'),
|
||||||
|
('id="field" ', ""),
|
||||||
|
('viewBox="0 0 512 512"', 'viewBox="0 0 100 100"'),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_banned_content_is_reported(needle: str, replacement: str) -> None:
|
||||||
|
assert make_logo_sheet.problems(GOOD.replace(needle, replacement, 1))
|
||||||
|
|
||||||
|
|
||||||
|
def test_unparseable_svg_is_reported() -> None:
|
||||||
|
assert make_logo_sheet.problems("<svg") != []
|
||||||
|
|
||||||
|
|
||||||
|
def test_main_writes_sheet(tmp_path: Path) -> None:
|
||||||
|
out = tmp_path / "sheet.png"
|
||||||
|
assert make_logo_sheet.main(["--dir", str(LOGO_DIR), "--out", str(out)]) == 0
|
||||||
|
sheet = Image.open(out)
|
||||||
|
rows, cols = 6, len(make_logo_sheet.VARIANTS) * len(make_logo_sheet.SIZES)
|
||||||
|
cell, gap = make_logo_sheet.CELL, make_logo_sheet.GAP
|
||||||
|
assert sheet.size == (
|
||||||
|
cols * cell + (cols + 1) * gap,
|
||||||
|
rows * cell + (rows + 1) * gap,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_main_refuses_invalid_svg(tmp_path: Path) -> None:
|
||||||
|
(tmp_path / "a-bad.svg").write_text(GOOD.replace("<path", "<text>k</text><path"))
|
||||||
|
assert (
|
||||||
|
make_logo_sheet.main(["--dir", str(tmp_path), "--out", str(tmp_path / "s.png")])
|
||||||
|
== 1
|
||||||
|
)
|
||||||
|
assert not (tmp_path / "s.png").exists()
|
||||||
|
|
||||||
|
|
||||||
|
def test_main_refuses_empty_dir(tmp_path: Path) -> None:
|
||||||
|
assert (
|
||||||
|
make_logo_sheet.main(["--dir", str(tmp_path), "--out", str(tmp_path / "s.png")])
|
||||||
|
== 1
|
||||||
|
)
|
||||||