art: generated brand system (icon, splash, feature graphic, tokens)
- tools/art/: SVG-authored art rasterised with librsvg. artlib.py provides gradients, blur/grain/vignette filters, Catmull-Rom paths, reproducible ridges, ballistics and type; gen_brand.py builds every asset; artgen.py is the CLI. - palette.json is the single source of truth: it drives the art *and* generates app/lib/src/ui/palette.dart (splash now reads Palette.ink0/solarBase). - new icon: dusk scene with sun, an asymmetric shot leaving the frame top-right and a tank silhouette at the muzzle. Legacy mipmaps + adaptive layers (background/foreground/monochrome) + anydpi-v26 XML, monochrome for Android 13 themed icons. - splash: circular badge (zoomed, mask-safe) for the Android 12 splash, badge + wordmark lockup for the pre-12 launch bitmap and the Flutter splash. The system icon plate is now identical to the background, so the badge floats. - feature graphic rebuilt as a poster: type block left, scene confined to the right half so the shot never crosses the wordmark. - type aligned with the store title: "TAKTISCHES PANZERDUELL". - docs/art-direction.md documents principles, palette, asset sources and the ingame phase 2 plan.
This commit is contained in:
Executable
+80
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env python3
|
||||
"""IRON ARC art pipeline.
|
||||
|
||||
python3 tools/art/artgen.py all # brand assets + Flutter tokens
|
||||
python3 tools/art/artgen.py brand # icons, splash, feature graphic
|
||||
python3 tools/art/artgen.py palette # app/lib/src/ui/palette.dart
|
||||
python3 tools/art/artgen.py preview # contact sheet in build/art-preview
|
||||
|
||||
Everything is SVG-authored and rasterised with librsvg, so the sources stay
|
||||
editable and every size is crisp. Colours come from palette.json - change a
|
||||
token there, re-run, and icons, splash, feature graphic and app theme follow.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
import artlib as A
|
||||
import gen_brand as brand
|
||||
|
||||
DART_OUT = A.ROOT / "app" / "lib" / "src" / "ui" / "palette.dart"
|
||||
|
||||
DART_HEADER = """// GENERATED FILE - do not edit by hand.
|
||||
// Source: tools/art/palette.json, generator: tools/art/artgen.py
|
||||
// Re-run `python3 tools/art/artgen.py palette` after changing a token.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Design tokens shared by the app and the generated art.
|
||||
abstract final class Palette {
|
||||
"""
|
||||
|
||||
|
||||
def _dart_color(value: str) -> str:
|
||||
h = value.lstrip("#").upper()
|
||||
if len(h) == 6:
|
||||
h = "FF" + h
|
||||
return f"Color(0x{h})"
|
||||
|
||||
|
||||
def write_palette() -> Path:
|
||||
data = json.loads((A.ART_DIR / "palette.json").read_text(encoding="utf-8"))
|
||||
lines = [DART_HEADER]
|
||||
for group, values in data.items():
|
||||
if group.startswith("$") or not isinstance(values, dict):
|
||||
continue
|
||||
lines.append(f" // {group}")
|
||||
for key, value in values.items():
|
||||
if isinstance(value, str) and value.startswith("#"):
|
||||
name = f"{group}{key[0].upper()}{key[1:]}"
|
||||
lines.append(f" static const {name} = {_dart_color(value)};")
|
||||
lines.append("")
|
||||
lines.append("}")
|
||||
text = "\n".join(lines) + "\n"
|
||||
DART_OUT.parent.mkdir(parents=True, exist_ok=True)
|
||||
DART_OUT.write_text(text, encoding="utf-8")
|
||||
return DART_OUT
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
cmd = argv[1] if len(argv) > 1 else "all"
|
||||
if cmd in ("brand", "all"):
|
||||
for path in brand.write_all():
|
||||
print(f" {path.relative_to(A.ROOT)} {path.stat().st_size} B")
|
||||
if cmd in ("palette", "all"):
|
||||
print(f" {write_palette().relative_to(A.ROOT)}")
|
||||
if cmd in ("preview", "all"):
|
||||
print("preview:", brand.preview().relative_to(A.ROOT))
|
||||
if cmd not in ("brand", "palette", "preview", "all"):
|
||||
print(__doc__)
|
||||
return 2
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main(sys.argv))
|
||||
Reference in New Issue
Block a user