LingSys
↓ 0 downloadsYour machine's memory, GPU, motherboard and network, drawn and played in the Ling design system: LingSys, a small build for USB liquid-cooler displays, LingNet for IPv4/IPv6, DNS and packets, and a LingOS edition. 64-bit and 32-bit Windows builds included.
Keywords system-monitor, visualization, network, ipv6, gpu, lcd, lingos, ling
lingfu install LingSysCode / Files (48)
tools/make_icons.py
#!/usr/bin/env python3
"""Draw the three app icons as SVG (line work in the Ling hues) and turn them into Windows .ico files.
python tools/make_icons.py
Writes icon.svg (LingSys and LingSysMini), icon_net.svg (LingNet), and assets/*.ico with the sizes Windows
asks for (16 to 256 px). The .ico files are embedded in the exes by tools/build_exe.py. Needs ImageMagick (`magick`).
"""
import colorsys, math, re, subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
HUES = [357, 28, 46, 140, 215, 247, 285]
def hexcol(h, s, l):
r, g, b = colorsys.hls_to_rgb(h / 360.0, l / 100.0, s / 100.0)
return '#%02x%02x%02x' % (round(r * 255), round(g * 255), round(b * 255))
def svg(body):
return ('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">\n'
'<rect width="256" height="256" rx="40" fill="#000"/>\n<g fill="none" stroke-linecap="round">\n'
+ '\n'.join(body) + '\n</g></svg>\n')
def rings(n, hubcol):
"""n concentric rings, each with a crosshatched arc, round a hub holding a circle and a square."""
out, cx = [], 128
step = 100 // n if n < 7 else 11
for i in range(n):
h = HUES[i % 7]
r = 112 - i * step
out.append('<circle cx="%d" cy="%d" r="%d" stroke="%s" stroke-width="1.5"/>' % (cx, cx, r, hexcol(h, 70, 30)))
sweep = [0.85, 0.6, 0.7, 0.35, 0.55, 0.8, 0.45][i % 7] * 2 * math.pi
a0, k, d = i * 0.9, int(sweep * r / 3.2), ''
for j in range(k):
a = a0 + j * sweep / k
d += 'M%.1f %.1fL%.1f %.1f' % (cx + (r - 4) * math.sin(a), cx - (r - 4) * math.cos(a),
cx + r * math.sin(a + 0.05), cx - r * math.cos(a + 0.05))
out.append('<path d="%s" stroke="%s" stroke-width="1.1"/>' % (d, hexcol(h, 80, 58)))
s = 26 / math.sqrt(2)
out.append('<circle cx="128" cy="128" r="26" stroke="%s" stroke-width="2"/>' % hubcol)
out.append('<rect x="%.1f" y="%.1f" width="%.1f" height="%.1f" stroke="%s" stroke-width="2"/>' % (128 - s, 128 - s, 2 * s, 2 * s, hubcol))
out.append('<rect x="%.1f" y="%.1f" width="%.1f" height="%.1f" stroke="%s" stroke-width="1.5" transform="rotate(45 128 128)"/>' % (128 - s, 128 - s, 2 * s, 2 * s, hexcol(285, 80, 70)))
return out
def constellation():
"""LingNet: a hub, seven sectors, spokes and dots (circle = IPv4, diamond = IPv6), like its FLOW view."""
out, cx, R = [], 128, 108
sec = 2 * math.pi / 7
for c in range(7):
h = HUES[c]
a0, a1 = c * sec + 0.05, (c + 1) * sec - 0.05
pts = [(cx + R * math.sin(a0 + (a1 - a0) * i / 24), cx - R * math.cos(a0 + (a1 - a0) * i / 24)) for i in range(25)]
out.append('<path d="M%s" stroke="%s" stroke-width="3"/>' % ('L'.join('%.1f %.1f' % p for p in pts), hexcol(h, 80, 55)))
out.append('<line x1="%d" y1="%d" x2="%.1f" y2="%.1f" stroke="%s" stroke-width="1"/>' % (
cx, cx, cx + R * 0.92 * math.sin(c * sec), cx - R * 0.92 * math.cos(c * sec), hexcol(h, 60, 22)))
for j in range(4):
a = c * sec + sec * (0.18 + 0.2 * j + 0.05 * (c % 2))
r = R * (0.42 + 0.12 * ((j * 3 + c) % 4))
x, y = cx + r * math.sin(a), cx - r * math.cos(a)
out.append('<line x1="%d" y1="%d" x2="%.1f" y2="%.1f" stroke="%s" stroke-width="1"/>' % (cx, cx, x, y, hexcol(h, 60, 26)))
if (c + j) % 3 == 0:
out.append('<rect x="%.1f" y="%.1f" width="9" height="9" stroke="%s" stroke-width="2" transform="rotate(45 %.1f %.1f)"/>' % (x - 4.5, y - 4.5, hexcol(h, 85, 66), x, y))
else:
out.append('<circle cx="%.1f" cy="%.1f" r="5" stroke="%s" stroke-width="2"/>' % (x, y, hexcol(h, 85, 66)))
out.append('<circle cx="128" cy="128" r="24" stroke="%s" stroke-width="2.5"/>' % hexcol(46, 80, 70))
out.append('<circle cx="128" cy="128" r="9" stroke="%s" stroke-width="2"/>' % hexcol(46, 80, 70))
return out
def ico(svg_path, ico_path):
ico_path.parent.mkdir(exist_ok=True)
subprocess.run(['magick', '-background', 'none', str(svg_path), '-define', 'icon:auto-resize=256,128,64,48,32,24,16', str(ico_path)], check=True)
print('wrote', ico_path, ico_path.stat().st_size, 'bytes')
if __name__ == '__main__':
(ROOT / 'icon.svg').write_text(svg(rings(7, hexcol(46, 80, 70))), encoding='utf8', newline='\n')
(ROOT / 'icon_net.svg').write_text(svg(constellation()), encoding='utf8', newline='\n')
ico(ROOT / 'icon.svg', ROOT / 'assets' / 'lingsys.ico')
ico(ROOT / 'icon_net.svg', ROOT / 'assets' / 'lingnet.ico')