Símbolo: farola en un aro, como un sello de tienda de graffiti

This commit is contained in:
hacklab 2026-10-14 12:46:00 +02:00
parent 0264caa2d0
commit b67ebf2132
12 changed files with 35 additions and 36 deletions

View file

@ -1,32 +1,30 @@
import sys
NAR, AMA, INK = "#f04e23", "#f2b705", "#111"
NAR, INK, BL = "#f04e23", "#111", "#fff"
def estrella(cx, cy, r, col, borde=None, bw=0):
k = r * .22
d = (f"M{cx},{cy - r} Q{cx + k},{cy - k} {cx + r},{cy} Q{cx + k},{cy + k} {cx},{cy + r} "
f"Q{cx - k},{cy + k} {cx - r},{cy} Q{cx - k},{cy - k} {cx},{cy - r} Z")
b = f' stroke="{borde}" stroke-width="{bw}" stroke-linejoin="round"' if borde else ""
return f'<path d="{d}" fill="{col}"{b}/>'
def farola(ink=INK, rell=NAR, fondo=None, brillo="#fff"):
def farola(estilo="aro", ink=INK, luz=NAR, fondo=None, papel=BL):
bg = f'<rect width="100" height="100" fill="{fondo}"/>' if fondo else ""
eje = "M27,99 V38 Q27,15 50,15 H62"
cabeza = "M56,9 Q60,4 74,4 Q90,4 94,12 Q96,18 88,20 H62 Q54,20 54,15 Q54,11 56,9 Z"
luz = f'<path d="M63,22 H88 L98,90 H50 Z" fill="{AMA}" opacity=".28"/><path d="M68,22 H83 L88,90 H58 Z" fill="{rell}" opacity=".35"/>'
gotas = "".join(f'<path d="M{x - w},{y0} L{x + w},{y0} L{x + w * .7},{y1} Q{x},{y1 + w * 1.7} {x - w * .7},{y1} Z" fill="{ink}"/>'
for x, w, y0, y1 in ((23.5, 2.2, 60, 72), (65, 1.8, 20, 28), (90, 1.5, 19, 25)))
return (f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">{bg}{luz}'
f'<path d="{eje}" fill="none" stroke="{ink}" stroke-width="17" stroke-linecap="round"/>'
f'<path d="{cabeza}" fill="{ink}" stroke="{ink}" stroke-width="7" stroke-linejoin="round"/>'
f'{gotas}'
f'<path d="{eje}" fill="none" stroke="{rell}" stroke-width="8" stroke-linecap="round"/>'
f'<path d="{cabeza}" fill="{rell}"/>'
f'<path d="M24.5,80 V52 M24.5,46 V43" stroke="{brillo}" stroke-width="2.4" stroke-linecap="round"/>'
f'<path d="M62,10 Q66,7 74,7" fill="none" stroke="{brillo}" stroke-width="2.4" stroke-linecap="round"/>'
f'{estrella(76, 52, 13, AMA, ink, 2.5)}{estrella(62, 74, 7, brillo, ink, 2)}</svg>\n')
if estilo == "aro":
defs = '<defs><clipPath id="c"><circle cx="50" cy="50" r="42"/></clipPath></defs>'
cono = f'<path d="M57,33 H77 L98,92 H36 Z" fill="{luz}" clip-path="url(#c)"/>'
suelo = f'<ellipse cx="67" cy="86" rx="22" ry="5" fill="{ink}" clip-path="url(#c)" opacity=".25"/>'
poste = f'<path d="M37,96 V40 Q37,25 52,25 H60" fill="none" stroke="{ink}" stroke-width="8"/>'
cabeza = f'<rect x="55" y="21" width="27" height="11" rx="3" fill="{ink}"/>'
aro = f'<circle cx="50" cy="50" r="45" fill="none" stroke="{ink}" stroke-width="7"/>'
return defs + cono + suelo + f'<g clip-path="url(#c)">{poste}</g>' + cabeza + aro
pegatina = f'<circle cx="50" cy="50" r="48" fill="{luz}"/>'
poste = f'<path d="M33,99 V38 Q33,22 49,22 H58" fill="none" stroke="{ink}" stroke-width="9"/>'
cabeza = f'<rect x="52" y="17" width="30" height="11" rx="3" fill="{ink}"/>'
rayos = "".join(f'<path d="M{x0},{y0} L{x1},{y1}" stroke="{papel}" stroke-width="4" stroke-linecap="round"/>'
for x0, y0, x1, y1 in ((58, 35, 50, 52), (67, 36, 67, 56), (76, 35, 84, 52)))
return f'<defs><clipPath id="c"><circle cx="50" cy="50" r="48"/></clipPath></defs>{pegatina}<g clip-path="url(#c)">{poste}</g>{cabeza}{rayos}'
def svg(cuerpo, fondo=None):
bg = f'<rect width="100" height="100" fill="{fondo}"/>' if fondo else ""
return f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">{bg}{cuerpo}</svg>\n'
if __name__ == "__main__":
d = sys.argv[1]
open(f"{d}/simbolo.svg", "w").write(farola())
open(f"{d}/simbolo-negativo.svg", "w").write(farola(fondo=INK, ink="#fff"))
open(f"{d}/simbolo-naranja.svg", "w").write(farola(fondo=NAR, rell="#fff", brillo=NAR))
open(f"{d}/simbolo.svg", "w").write(svg(farola()))
open(f"{d}/simbolo-negativo.svg", "w").write(svg(farola(ink=BL, papel=INK), INK))
open(f"{d}/simbolo-naranja.svg", "w").write(svg(farola(luz=BL, papel=NAR), NAR))
open(f"{d}/simbolo-pegatina.svg", "w").write(svg(farola("pegatina")))