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:
@@ -0,0 +1,558 @@
|
||||
"""Generates the IRON ARC brand art: launcher icon (legacy + adaptive +
|
||||
monochrome), splash lockup and the Play feature graphic.
|
||||
|
||||
python3 tools/art/artgen.py brand
|
||||
|
||||
All output is derived from ../palette.json, so a colour change propagates
|
||||
everywhere. Art is authored as SVG and rasterised, never painted pixel by pixel.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
import artlib as A
|
||||
|
||||
P = A.Palette.load()
|
||||
INK0 = P.color("ink.0")
|
||||
INK1 = P.color("ink.1")
|
||||
INK2 = P.color("ink.2")
|
||||
INK3 = P.color("ink.3")
|
||||
SOLAR_L = P.color("solar.light")
|
||||
SOLAR = P.color("solar.base")
|
||||
SOLAR_D = P.color("solar.deep")
|
||||
STEEL_L = P.color("steel.light")
|
||||
STEEL = P.color("steel.base")
|
||||
RIM = P.color("terrain.rim")
|
||||
SOIL = P.color("terrain.soil")
|
||||
DEEP = P.color("terrain.deep")
|
||||
TEXT_HI = P.color("text.hi")
|
||||
TEXT_MID = P.color("text.mid")
|
||||
WEIGHT = int(P.value("type.displayWeight"))
|
||||
TRACK = float(P.value("type.trackingEm"))
|
||||
|
||||
ANDROID = A.ROOT / "app" / "android" / "app" / "src" / "main" / "res"
|
||||
APP_ASSETS = A.ROOT / "app" / "assets"
|
||||
STORE = A.ROOT / "store" / "assets"
|
||||
PREVIEW = A.ROOT / "build" / "art-preview"
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# shared scene pieces
|
||||
# --------------------------------------------------------------------------- #
|
||||
def sky_defs(tag: str, w: float, h: float, horizon: float) -> str:
|
||||
"""Dusk gradient plus a warm glow sitting on the horizon."""
|
||||
return (
|
||||
A.linear_gradient(
|
||||
f"sky{tag}",
|
||||
[
|
||||
(0.00, INK0, 1),
|
||||
(0.45, INK1, 1),
|
||||
(0.78, "#132135", 1),
|
||||
(1.00, "#1B2C44", 1),
|
||||
],
|
||||
)
|
||||
+ A.radial_gradient(
|
||||
f"glow{tag}",
|
||||
[(0.00, SOLAR_D, 0.55), (0.45, SOLAR_D, 0.20), (1.00, SOLAR_D, 0.0)],
|
||||
cx=0.5,
|
||||
cy=horizon / h,
|
||||
r=0.62,
|
||||
)
|
||||
+ A.blur_filter(f"soft{tag}", 6)
|
||||
)
|
||||
|
||||
|
||||
def sky(w: float, h: float, horizon: float, tag: str = "") -> str:
|
||||
return (
|
||||
f'<rect width="{w}" height="{h}" fill="url(#sky{tag})"/>'
|
||||
f'<rect width="{w}" height="{h}" fill="url(#glow{tag})"/>'
|
||||
)
|
||||
|
||||
|
||||
def sun(cx: float, cy: float, r: float, tag: str = "") -> str:
|
||||
"""Sun disc with a soft corona - the light source of every composition."""
|
||||
return (
|
||||
f'<circle cx="{cx}" cy="{cy}" r="{r * 1.85}" fill="{SOLAR}" '
|
||||
f'opacity="0.15" filter="url(#soft{tag})"/>'
|
||||
f'<circle cx="{cx}" cy="{cy}" r="{r}" fill="url(#sun{tag})"/>'
|
||||
)
|
||||
|
||||
|
||||
def sun_defs(tag: str) -> str:
|
||||
return A.radial_gradient(
|
||||
f"sun{tag}",
|
||||
[
|
||||
(0.00, "#FFF3DC", 1),
|
||||
(0.42, SOLAR_L, 1),
|
||||
(0.78, SOLAR, 1),
|
||||
(1.00, SOLAR_D, 1),
|
||||
],
|
||||
cx=0.42,
|
||||
cy=0.38,
|
||||
r=0.62,
|
||||
)
|
||||
|
||||
|
||||
def ridge(
|
||||
points: list[tuple[float, float]],
|
||||
fill: str,
|
||||
rim: str,
|
||||
rim_width: float,
|
||||
tag: str = "",
|
||||
) -> str:
|
||||
fill = fill.replace("{tag}", tag)
|
||||
"""Silhouette plus the warm rim light that separates it from the sky."""
|
||||
d = A.smooth_path(points, closed=True)
|
||||
open_d = A.smooth_path(points[:-2]) if len(points) > 2 else d
|
||||
return (
|
||||
f'<path d="{d}" fill="{fill}"/>'
|
||||
f'<path d="{open_d}" fill="none" stroke="{rim}" stroke-width="{rim_width}" '
|
||||
f'stroke-linecap="round" opacity="0.85"/>'
|
||||
)
|
||||
|
||||
|
||||
def shot_trail(pts: list[tuple[float, float]], width: float, *, dots: int = 10) -> str:
|
||||
"""Directional trail: fading dots behind, one crisp stroke in front.
|
||||
|
||||
A full parabola reads as a dome (and as a rainbow); letting the shot leave
|
||||
the frame keeps the icon dynamic."""
|
||||
cut = int(len(pts) * 0.30)
|
||||
trail = ""
|
||||
for i in range(dots):
|
||||
t = i / max(dots - 1, 1)
|
||||
x, y = pts[int(t * cut)]
|
||||
r = width * (0.18 + 0.26 * t)
|
||||
trail += (
|
||||
f'<circle cx="{x:.2f}" cy="{y:.2f}" r="{r:.2f}" fill="{SOLAR_L}" '
|
||||
f'opacity="{0.14 + 0.20 * t:.2f}"/>'
|
||||
)
|
||||
head = A.smooth_path(pts[cut:])
|
||||
head_full = A.smooth_path(pts)
|
||||
return (
|
||||
trail
|
||||
+ f'<path d="{head_full}" fill="none" stroke="{SOLAR}" '
|
||||
f'stroke-width="{width * 1.8:.2f}" stroke-linecap="round" '
|
||||
f'opacity="0.18" filter="url(#softx)"/>'
|
||||
+ f'<path d="{head}" fill="none" stroke="url(#arc)" '
|
||||
f'stroke-width="{width:.2f}" stroke-linecap="round"/>'
|
||||
)
|
||||
|
||||
|
||||
def arc_defs() -> str:
|
||||
return A.linear_gradient(
|
||||
"arc", [(0.0, SOLAR_L, 1), (0.55, SOLAR, 1), (1.0, SOLAR_D, 1)]
|
||||
) + A.blur_filter("softx", 5)
|
||||
|
||||
|
||||
def finish(w: float, h: float, grain: float = 0.06, vig: float = 0.5) -> str:
|
||||
"""Grain + vignette over the whole frame - the cheap trick that sells depth."""
|
||||
return (
|
||||
f'<rect width="{w}" height="{h}" fill="url(#vig)" />'
|
||||
f'<rect width="{w}" height="{h}" filter="url(#grain)" opacity="{grain}" '
|
||||
f'style="mix-blend-mode:overlay"/>'
|
||||
)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# the glyph: sun, two ridges, one ballistic arc
|
||||
# --------------------------------------------------------------------------- #
|
||||
def tank(
|
||||
cx: float,
|
||||
base_y: float,
|
||||
size: float,
|
||||
*,
|
||||
fill: str,
|
||||
rim: str,
|
||||
angle: float = -32.0,
|
||||
flip: bool = False,
|
||||
) -> str:
|
||||
"""A silhouette tank: hull, turret, barrel. Only reads below ~64 px as a
|
||||
bump with a stick, which is exactly what a launcher icon needs."""
|
||||
w = size * (1 if not flip else -1)
|
||||
hull_h = size * 0.30
|
||||
turret_w = size * 0.44
|
||||
turret_h = size * 0.20
|
||||
barrel_w = size * 0.11
|
||||
barrel_l = size * 0.62
|
||||
body = (
|
||||
# hull: slightly tapered block
|
||||
f'<path d="M {cx - w * 0.5:.2f} {base_y:.2f} '
|
||||
f'L {cx + w * 0.5:.2f} {base_y:.2f} '
|
||||
f'L {cx + w * 0.44:.2f} {base_y - hull_h:.2f} '
|
||||
f'L {cx - w * 0.44:.2f} {base_y - hull_h:.2f} Z" fill="{fill}"/>'
|
||||
# turret
|
||||
f'<rect x="{cx - turret_w / 2:.2f}" y="{base_y - hull_h - turret_h:.2f}" '
|
||||
f'width="{turret_w:.2f}" height="{turret_h * 1.15:.2f}" '
|
||||
f'rx="{turret_h * 0.55:.2f}" fill="{fill}"/>'
|
||||
# barrel, pivoting at the turret centre
|
||||
f'<g transform="rotate({angle} {cx:.2f} {base_y - hull_h - turret_h * 0.4:.2f})">'
|
||||
f'<rect x="{cx - barrel_w / 2:.2f}" '
|
||||
f'y="{base_y - hull_h - turret_h * 0.4 - barrel_l:.2f}" '
|
||||
f'width="{barrel_w:.2f}" height="{barrel_l:.2f}" '
|
||||
f'rx="{barrel_w * 0.45:.2f}" fill="{fill}"/>'
|
||||
f'</g>'
|
||||
# rim light on the hull top edge
|
||||
f'<path d="M {cx - w * 0.44:.2f} {base_y - hull_h:.2f} '
|
||||
f'L {cx + w * 0.44:.2f} {base_y - hull_h:.2f}" stroke="{rim}" '
|
||||
f'stroke-width="{size * 0.035:.2f}" stroke-linecap="round" opacity="0.9"/>'
|
||||
)
|
||||
return (
|
||||
f'<ellipse cx="{cx:.2f}" cy="{base_y + size * 0.03:.2f}" '
|
||||
f'rx="{size * 0.52:.2f}" ry="{size * 0.05:.2f}" fill="#000000" '
|
||||
f'opacity="0.45"/>' + body
|
||||
)
|
||||
|
||||
|
||||
def muzzle_glow(x: float, y: float, r: float) -> str:
|
||||
"""Warm bloom right at the barrel mouth - the shot just left."""
|
||||
return (
|
||||
f'<circle cx="{x:.2f}" cy="{y:.2f}" r="{r:#.2f}" fill="{SOLAR_L}" '
|
||||
f'opacity="0.35" filter="url(#softx)"/>'
|
||||
)
|
||||
|
||||
|
||||
def stars(S: float, count: int = 7, seed: int = 3, size: float | None = None, x0: float = 0.05) -> str:
|
||||
"""A few dim points of light: fills the empty sky without becoming noise."""
|
||||
import random
|
||||
|
||||
rnd = random.Random(seed)
|
||||
unit = size if size is not None else S
|
||||
out = ""
|
||||
for _ in range(count):
|
||||
x = rnd.uniform(x0, 0.95) * S
|
||||
y = rnd.uniform(0.04, 0.42) * S
|
||||
r = rnd.uniform(0.0025, 0.0055) * unit
|
||||
a = rnd.uniform(0.20, 0.55)
|
||||
out += f'<circle cx="{x:.2f}" cy="{y:.2f}" r="{r:.2f}" fill="#DCE6F5" opacity="{a:.2f}"/>'
|
||||
return out
|
||||
|
||||
|
||||
def glyph(
|
||||
S: float,
|
||||
tag: str,
|
||||
*,
|
||||
with_sky: bool = True,
|
||||
k: float = 1.0,
|
||||
dy: float = 0.0,
|
||||
rim_alpha: float = 1.0,
|
||||
) -> str:
|
||||
"""Drawable in a 0..S box; `k` shrinks it for the adaptive safe zone."""
|
||||
horizon = 0.715 * S
|
||||
body = ""
|
||||
if with_sky:
|
||||
body += sky(S, S, horizon, tag)
|
||||
# The shot leaves the frame at the top right: no dome, no rainbow.
|
||||
# muzzle sits at the barrel tip (see tank(): pivot + L at 38 deg)
|
||||
shot = A.ballistic_arc(
|
||||
0.340 * S, 0.623 * S, 1.080 * S, -0.180 * S, apex_y=0.155 * S, steps=48
|
||||
)
|
||||
inner = (
|
||||
stars(S)
|
||||
+ sun(0.690 * S, 0.640 * S, 0.135 * S, tag)
|
||||
+ ridge(
|
||||
A.hill_ridge(S, 0.775 * S, 0.046 * S, seed=7, steps=6, foot=S),
|
||||
"#0F1B2E",
|
||||
A.rgba(RIM, 0.20),
|
||||
0.007 * S,
|
||||
tag,
|
||||
)
|
||||
+ shot_trail(shot, 0.024 * S)
|
||||
+ muzzle_glow(0.340 * S, 0.623 * S, 0.024 * S)
|
||||
+ ridge(
|
||||
A.hill_ridge(S, 0.862 * S, 0.030 * S, seed=11, steps=4, phase=0.42, foot=S),
|
||||
"url(#ground{tag})",
|
||||
A.rgba(SOLAR_L, 0.38 * rim_alpha),
|
||||
0.009 * S,
|
||||
tag,
|
||||
)
|
||||
+ tank(
|
||||
0.225 * S,
|
||||
0.884 * S,
|
||||
0.30 * S,
|
||||
fill="#0B1420",
|
||||
rim=A.rgba(SOLAR_L, 0.60),
|
||||
angle=38,
|
||||
)
|
||||
)
|
||||
if k >= 1.0:
|
||||
return body + inner
|
||||
t = S * (1 - k) / 2
|
||||
return body + f'<g transform="translate({t:.2f},{t:.2f}) scale({k})">{inner}</g>'
|
||||
|
||||
|
||||
def glyph_defs(tag: str) -> str:
|
||||
return (
|
||||
A.linear_gradient(
|
||||
f"ground{tag}",
|
||||
[(0.0, "#241D13", 1), (0.40, "#120F0A", 1), (1.0, "#07080A", 1)],
|
||||
)
|
||||
+ sky_defs(tag, 1, 1, 0.705)
|
||||
+ sun_defs(tag)
|
||||
+ arc_defs()
|
||||
+ A.grain_filter()
|
||||
+ A.vignette_def()
|
||||
)
|
||||
|
||||
|
||||
def icon_svg(S: int = 1024) -> str:
|
||||
return A.svg_doc(
|
||||
S,
|
||||
S,
|
||||
glyph(S, "") + finish(S, S, grain=0.05, vig=0.42),
|
||||
glyph_defs(""),
|
||||
)
|
||||
|
||||
|
||||
def foreground_svg(S: int = 432) -> str:
|
||||
"""Adaptive icon foreground: transparent, content inside the 72/108 safe zone."""
|
||||
return A.svg_doc(S, S, glyph(S, "f", with_sky=False, k=0.58, dy=-0.02), glyph_defs("f"))
|
||||
|
||||
|
||||
def background_svg(S: int = 432) -> str:
|
||||
return A.svg_doc(
|
||||
S,
|
||||
S,
|
||||
sky(S, S, 0.705 * S, "b") + finish(S, S, grain=0.05, vig=0.45),
|
||||
sky_defs("b", S, S, 0.705 * S) + A.grain_filter() + A.vignette_def(),
|
||||
)
|
||||
|
||||
|
||||
def monochrome_svg(S: int = 432) -> str:
|
||||
"""Android 13 themed icons: one ink, tinted by the launcher."""
|
||||
shot = A.ballistic_arc(
|
||||
0.340 * S, 0.623 * S, 1.080 * S, -0.180 * S, apex_y=0.155 * S, steps=40
|
||||
)
|
||||
body = (
|
||||
f'<circle cx="{0.690 * S:.2f}" cy="{0.640 * S:.2f}" r="{0.115 * S:.2f}" '
|
||||
f'fill="#FFFFFF"/>'
|
||||
f'<path d="{A.smooth_path(shot)}" fill="none" stroke="#FFFFFF" '
|
||||
f'stroke-width="{0.030 * S:.2f}" stroke-linecap="round"/>'
|
||||
f'<path d="M {0.060 * S:.2f} {0.868 * S:.2f} L {0.940 * S:.2f} {0.868 * S:.2f}" '
|
||||
f'stroke="#FFFFFF" stroke-width="{0.030 * S:.2f}" stroke-linecap="round"/>'
|
||||
)
|
||||
t = S * 0.13
|
||||
return A.svg_doc(S, S, f'<g transform="translate({t:.2f},{t:.2f}) scale(0.74)">{body}</g>')
|
||||
|
||||
|
||||
def splash_icon_svg(S: int = 512) -> str:
|
||||
"""Android 12+ splash icon: badge only, inside the mask-safe 60 % of the canvas."""
|
||||
r = S * 0.32
|
||||
cx = cy = S / 2
|
||||
body = clip_def("s", cx, cy, r) + badge(cx, cy, r, "s", zoom=1.28, focus=(0.56, 0.615))
|
||||
return A.svg_doc(S, S, body, glyph_defs("s"))
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# circular badge + wordmark lockup
|
||||
# --------------------------------------------------------------------------- #
|
||||
def clip_def(tag: str, cx: float, cy: float, r: float) -> str:
|
||||
return (
|
||||
f'<clipPath id="clip{tag}">'
|
||||
f'<circle cx="{cx:.2f}" cy="{cy:.2f}" r="{r:.2f}"/></clipPath>'
|
||||
)
|
||||
|
||||
|
||||
def badge(
|
||||
cx: float,
|
||||
cy: float,
|
||||
r: float,
|
||||
tag: str,
|
||||
*,
|
||||
zoom: float = 1.30,
|
||||
focus: tuple[float, float] = (0.55, 0.60),
|
||||
) -> str:
|
||||
"""The glyph art zoomed onto its subject and clipped to a circle.
|
||||
|
||||
A circular badge cannot show the square scene - the corners are masked away -
|
||||
so the art is scaled up and centred on sun, arc and tank."""
|
||||
inner = 2048
|
||||
s = (2 * r * zoom) / inner
|
||||
tx = cx - focus[0] * inner * s
|
||||
ty = cy - focus[1] * inner * s
|
||||
return (
|
||||
f'<g clip-path="url(#clip{tag})">'
|
||||
f'<g transform="translate({tx:.2f},{ty:.2f}) scale({s:.5f})">'
|
||||
f"{glyph(inner, tag, rim_alpha=0.18)}</g></g>"
|
||||
f'<circle cx="{cx:.2f}" cy="{cy:.2f}" r="{r:.2f}" fill="none" '
|
||||
f'stroke="{A.rgba(SOLAR, 0.55)}" stroke-width="{max(1.5, r * 0.012):.2f}"/>'
|
||||
)
|
||||
|
||||
|
||||
def lockup_svg(w: int = 640, h: int = 780, *, badge_only: bool = False) -> str:
|
||||
"""Circular badge above the wordmark - used for splash and store listing."""
|
||||
r = 138.0
|
||||
cx, cy = w / 2, 176.0
|
||||
body = (
|
||||
clip_def("k", cx, cy, r)
|
||||
+ badge(cx, cy, r, "k")
|
||||
+ f'<circle cx="{cx}" cy="{cy}" r="{r * 1.16:.1f}" fill="{SOLAR}" '
|
||||
f'opacity="0.09" filter="url(#softk)"/>'
|
||||
)
|
||||
if badge_only:
|
||||
return A.svg_doc(w, h, body, glyph_defs("k") + A.blur_filter("softk", 12))
|
||||
|
||||
title_y = cy + r + 126
|
||||
body += (
|
||||
f'<text x="{cx}" y="{title_y}" font-family="Roboto" font-weight="900" '
|
||||
f'font-size="104" letter-spacing="-2" text-anchor="middle">'
|
||||
f'<tspan fill="{TEXT_HI}">IRON</tspan>'
|
||||
f'<tspan fill="{SOLAR}" dx="22">ARC</tspan></text>'
|
||||
f'<text x="{cx}" y="{title_y + 54}" font-family="Roboto" font-weight="500" '
|
||||
f'font-size="25" letter-spacing="7" text-anchor="middle" '
|
||||
f'fill="{TEXT_MID}">TAKTISCHES PANZERDUELL</text>'
|
||||
)
|
||||
return A.svg_doc(w, h, body, glyph_defs("k") + A.blur_filter("softk", 12))
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Play feature graphic 1024x500
|
||||
# --------------------------------------------------------------------------- #
|
||||
def feature_svg(w: int = 1024, h: int = 500) -> str:
|
||||
"""Title block left, self-contained dusk scene in the right half.
|
||||
|
||||
The shot stays inside its half of the canvas - a line crossing the wordmark
|
||||
is exactly the kind of detail that makes store art look amateurish.
|
||||
"""
|
||||
horizon = 0.66 * h
|
||||
shot = A.ballistic_arc(
|
||||
0.585 * w, 0.615 * h, 1.045 * w, -0.070 * h, apex_y=0.165 * h, steps=56
|
||||
)
|
||||
body = (
|
||||
sky(w, h, horizon, "f")
|
||||
+ stars(w, 6, seed=5, size=min(w, h), x0=0.62)
|
||||
+ sun(0.755 * w, 0.440 * h, 0.105 * w, "f")
|
||||
+ ridge(
|
||||
A.hill_ridge(w, 0.660 * h, 0.038 * h, seed=7, steps=7, foot=h),
|
||||
"#0F1B2E",
|
||||
A.rgba(RIM, 0.22),
|
||||
2.0,
|
||||
"f",
|
||||
)
|
||||
+ shot_trail(shot, 3.2)
|
||||
+ ridge(
|
||||
A.hill_ridge(w, 0.870 * h, 0.048 * h, seed=11, steps=5, phase=0.42, foot=h),
|
||||
"url(#groundf)",
|
||||
A.rgba(SOLAR_L, 0.34),
|
||||
2.4,
|
||||
"f",
|
||||
)
|
||||
+ f'<rect x="0" y="0" width="{w * 0.54:.0f}" height="{h}" fill="url(#scrim)"/>'
|
||||
+ text_block(w)
|
||||
+ finish(w, h, grain=0.05, vig=0.36)
|
||||
)
|
||||
defs = (
|
||||
glyph_defs("f")
|
||||
+ A.linear_gradient(
|
||||
"groundf",
|
||||
[(0.0, "#2A2318", 1), (0.40, "#14110C", 1), (1.0, "#07080A", 1)],
|
||||
)
|
||||
+ A.linear_gradient(
|
||||
"scrim",
|
||||
[(0.0, INK0, 0.97), (0.62, INK0, 0.88), (1.0, INK0, 0.0)],
|
||||
x1=0,
|
||||
y1=0,
|
||||
x2=1,
|
||||
y2=0,
|
||||
)
|
||||
)
|
||||
return A.svg_doc(w, h, body, defs)
|
||||
|
||||
|
||||
def text_block(w: float) -> str:
|
||||
"""Type lockup: one accent word, wide-tracked caps for the rest."""
|
||||
return (
|
||||
f'<text x="64" y="202" font-family="Roboto" font-weight="900" '
|
||||
f'font-size="100" letter-spacing="-3">'
|
||||
f'<tspan fill="{TEXT_HI}">IRON</tspan>'
|
||||
f'<tspan fill="{SOLAR}" dx="22">ARC</tspan></text>'
|
||||
f'<text x="66" y="250" font-family="Roboto" font-weight="500" '
|
||||
f'font-size="21" letter-spacing="4" fill="{TEXT_MID}">'
|
||||
f'TAKTISCHES PANZERDUELL</text>'
|
||||
f'<rect x="66" y="274" width="112" height="3" rx="1.5" '
|
||||
f'fill="{SOLAR}" opacity="0.85"/>'
|
||||
f'<text x="66" y="314" font-family="Roboto" font-weight="400" '
|
||||
f'font-size="20" letter-spacing="2" fill="{TEXT_MID}">'
|
||||
f'1 GEGEN 1 · OFFLINE UND ONLINE</text>'
|
||||
)
|
||||
|
||||
|
||||
ADAPTIVE_XML = """<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generated by tools/art/artgen.py - do not edit by hand. -->
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
|
||||
</adaptive-icon>
|
||||
"""
|
||||
|
||||
DENSITIES = {
|
||||
"mdpi": 1.0,
|
||||
"hdpi": 1.5,
|
||||
"xhdpi": 2.0,
|
||||
"xxhdpi": 3.0,
|
||||
"xxxhdpi": 4.0,
|
||||
}
|
||||
|
||||
|
||||
def write_all() -> list[Path]:
|
||||
"""Render every brand asset into the app and the store folder."""
|
||||
written: list[Path] = []
|
||||
|
||||
written.append(A.render(icon_svg(1024), STORE / "icon_512.png", width=512))
|
||||
written.append(A.render(feature_svg(), STORE / "feature_1024x500.png"))
|
||||
|
||||
lockup = A.render(lockup_svg(), STORE / "logo_mark.png", width=640)
|
||||
written.append(lockup)
|
||||
written.append(A.render(lockup_svg(), APP_ASSETS / "logo_mark.png", width=640))
|
||||
|
||||
written.append(A.render(lockup_svg(), ANDROID / "drawable-xxxhdpi" / "launch_logo.png", width=512))
|
||||
written.append(
|
||||
A.render(splash_icon_svg(512), ANDROID / "drawable-xxxhdpi" / "launch_logo_splash.png")
|
||||
)
|
||||
|
||||
for density, factor in DENSITIES.items():
|
||||
folder = ANDROID / f"mipmap-{density}"
|
||||
legacy = int(48 * factor)
|
||||
adaptive = int(108 * factor)
|
||||
written.append(A.render(icon_svg(1024), folder / "ic_launcher.png", width=legacy))
|
||||
written.append(
|
||||
A.render(foreground_svg(adaptive), folder / "ic_launcher_foreground.png")
|
||||
)
|
||||
written.append(
|
||||
A.render(background_svg(adaptive), folder / "ic_launcher_background.png")
|
||||
)
|
||||
written.append(
|
||||
A.render(monochrome_svg(adaptive), folder / "ic_launcher_monochrome.png")
|
||||
)
|
||||
|
||||
anydpi = ANDROID / "mipmap-anydpi-v26"
|
||||
anydpi.mkdir(parents=True, exist_ok=True)
|
||||
for name in ("ic_launcher.xml", "ic_launcher_round.xml"):
|
||||
path = anydpi / name
|
||||
path.write_text(ADAPTIVE_XML, encoding="utf-8")
|
||||
written.append(path)
|
||||
return written
|
||||
|
||||
|
||||
def preview() -> Path:
|
||||
items = [
|
||||
STORE / "icon_512.png",
|
||||
STORE / "feature_1024x500.png",
|
||||
STORE / "logo_mark.png",
|
||||
ANDROID / "drawable-xxxhdpi" / "launch_logo_splash.png",
|
||||
ANDROID / "mipmap-xxxhdpi" / "ic_launcher.png",
|
||||
ANDROID / "mipmap-mdpi" / "ic_launcher.png",
|
||||
ANDROID / "mipmap-xxxhdpi" / "ic_launcher_foreground.png",
|
||||
ANDROID / "mipmap-xxxhdpi" / "ic_launcher_monochrome.png",
|
||||
]
|
||||
return A.contact_sheet(items, PREVIEW / "brand.png", cols=3, cell=340)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
for f in write_all():
|
||||
print(f.relative_to(A.ROOT), f.stat().st_size, "bytes")
|
||||
print("preview:", preview())
|
||||
Reference in New Issue
Block a user