From 0e86592d40a4a4761214801444517d0c858714de Mon Sep 17 00:00:00 2001 From: Burrowdev Date: Sat, 17 Oct 2026 21:35:34 +0300 Subject: [PATCH] feat: verified badge A blue scalloped seal with a tick, listed first so it sits straight after the name. tools/make-badges.py draws it (verified.png and verified.swf). --- lib/badges.js | 2 ++ public/badges/verified.png | Bin 0 -> 945 bytes swf/badges/verified.swf | Bin 0 -> 1129 bytes tools/make-badges.py | 56 ++++++++++++++++++++++++++++++++++++- 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 public/badges/verified.png create mode 100644 swf/badges/verified.swf diff --git a/lib/badges.js b/lib/badges.js index 2eb0592..2202b8d 100644 --- a/lib/badges.js +++ b/lib/badges.js @@ -35,6 +35,8 @@ const cdn = require("./cdn.js"); // in the order they are listed and drawn. const BADGES = [ + // first, so its tick comes straight after the name, as on other sites. + {id: "verified", label: "Verified", tag: {def: 76, media: 20014, bit: 21}}, {id: "owner", label: "Owner", tag: {def: 63, media: 20001, bit: 8}}, {id: "moderator", label: "Moderator", tag: {def: 64, media: 20002, bit: 9}}, {id: "contributor", label: "Contributor", tag: {def: 65, media: 20003, bit: 10}}, diff --git a/public/badges/verified.png b/public/badges/verified.png new file mode 100644 index 0000000000000000000000000000000000000000..f4b96269519cfb6148cf27d84bbc5f4ea70a9c6f GIT binary patch literal 945 zcmV;i15W&jP)ZKRgQ~fKHrC1fC21UhPfpLqnl?vj5+g!N! z;6c!s-lVL<(iyt{{Jj9BKxg{iKbA@;gb+>g1v$L&%F`?POvwS`^+mN;DpQ+ ze&3Tx0YRcwb^BSy(|;c96(=nS66x*FAdn(|Dd$+I!spbh!kz}zg&J>0#^AA9_Sqk zf#eEkj_K&p3GWTVi53Nn>`gL98rX4fLPo$MuigVagP};6jvoJlG1c8(-SEeo6=2;r z%It^R_PgUU0$RCs6LZ4PRQq>-WQ_I8q;B|QO$xB=8N+M?+wP1z5YYPiOZ%`OO;|r` zhbMKk(E}{|X_!5PvTl!=vTDbG)@i!}MyukJ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em`u;o|$>+$7E?)Kcxyg6}KxmEZ&*F4+Td36q~Ocy@Pg=fz>T|>#m^LGyZ`Pa}lpA3zz zT`OG7y*l^!%5);LmM^4p@0?2<{Vm zOSk816ZW-qA)H;G`GYxi0p!mXr0n&X%ST>0aq;r`Z-4Lm>Z8%;KY0JCADWlnTljAH z$7@Frh-S28Ga`_&)T3`M3{e3BIEMHLoFsO4>4Z!Oib2SrWk#g-Q<%;eH3x9%ogLKb z`Y5WXxBz*(v6-k)RXNE{*&@=o0E0yi`fC$Js8|MMMbKbX1J+<_#2W}uO<*{In+dFnz$}E> zO5ipEuO{#s0VX_bCjS76mOmQ{K+4A2Ni0^1X- vGz2j-9jl^a7CJ`IF)JOj(J>rdFM!8NZ3IK|qxE%0VVXfDDTC|ZiHn8FqrNVq literal 0 HcmV?d00001 diff --git a/tools/make-badges.py b/tools/make-badges.py index aa81153..93d6745 100644 --- a/tools/make-badges.py +++ b/tools/make-badges.py @@ -178,8 +178,29 @@ def sprout(): return [(stem, False), (small, False), (large, False)] -# id, outline, and the card disc's colours: top, bottom, rim. +def seal_points(): + """A round seal with eight soft scallops, as verified accounts have.""" + steps = 96 + return [(7.5 * (1 + 0.075 * math.cos(math.radians(8 * angle))) * math.cos(math.radians(angle)), + 7.5 * (1 + 0.075 * math.cos(math.radians(8 * angle))) * math.sin(math.radians(angle))) + for angle in (360 * step / steps - 90 for step in range(steps))] + + +def seal_tick(): + return [(x * 0.52, y * 0.52 + 0.3) for x, y in tick()[0][0]] + + +def verified(): + # the seal with the tick cut out of it, so the name tag's colour shows + # the seal and the tag behind shows through the tick. + return [(seal_points(), False), (seal_tick(), True)] + + +# id, outline, and the card disc's colours: top, bottom, rim. a badge whose +# rim is None has no disc: its outline's solid pieces are shaded instead, +# and its holes are white (the verified seal, blue with a white tick). BADGES = [ + ("verified", verified, "#4cb3ff", "#1478e6", None), ("owner", crown, "#ffd95a", "#f0a11c", "#96600a"), ("moderator", shield, "#5cb2ff", "#1f6fd6", "#12458a"), ("contributor", wrench, "#6fd878", "#2f9e3a", "#19621f"), @@ -262,6 +283,8 @@ def card_pixels(paths, top, bottom, rim): """CARD_SIZE square of (r, g, b, a): a disc shaded from `top` to `bottom` with a `rim`, the outline in white on it. Sixteen samples to a pixel.""" + if rim is None: + return shape_pixels(paths, top, bottom) paths = fitted(paths, CARD_HALF) top, bottom, rim = rgb(top), rgb(bottom), rgb(rim) middle, fill_radius, rim_radius = CARD_SIZE / 2, 20.0, 23.0 @@ -291,6 +314,37 @@ def card_pixels(paths, top, bottom, rim): return rows +def shape_pixels(paths, top, bottom): + """CARD_SIZE square of (r, g, b, a): the outline's solid pieces, as big + as the disc, shaded from `top` to `bottom`, and its holes in white.""" + paths = fitted(paths, 23.0) + solid = [(points, False) for points, hole in paths if not hole] + holes = [(points, False) for points, hole in paths if hole] + top, bottom = rgb(top), rgb(bottom) + middle = CARD_SIZE / 2 + rows = [] + for py in range(CARD_SIZE): + row = [] + for px in range(CARD_SIZE): + total = [0.0, 0.0, 0.0, 0.0] + for sy in range(4): + for sx in range(4): + x, y = px + (sx + 0.5) / 4 - middle, py + (sy + 0.5) / 4 - middle + if not inside(solid, x, y): + continue + if inside(holes, x, y): + colour = (255, 255, 255) + else: + shade = (y + 23.0) / 46.0 + colour = tuple(a + (b - a) * shade for a, b in zip(top, bottom)) + for channel in range(3): + total[channel] += colour[channel] + total[3] += 1 + row.append(tuple(round(total[c] / total[3]) if total[3] else 0 for c in range(3)) + (round(total[3] / 16 * 255),)) + rows.append(row) + return rows + + def png(rows): raw = b"".join(b"\x00" + bytes(value for pixel in row for value in pixel) for row in rows)