Skillfarm / website · skillfarm.ai / src / views / art.ts
| 1 | // Flat, 2D artwork drawn as inline SVG. No gradients, no filters. |
| 2 | import { raw } from 'hono/html'; |
| 3 | |
| 4 | export const SPROUT_PATH = 'M230 460 V386 C230 358 140 344 102 240 C180 234 230 268 230 310 V292 C230 172 318 86 446 70 C440 196 350 262 296 284 C276 292 270 302 270 324 V460 A20 20 0 0 1 230 460Z'; |
| 5 | |
| 6 | export const sprout = (size = 28, color = 'currentColor', cls = '') => |
| 7 | raw(`<svg class="${cls}" width="${size}" height="${size}" viewBox="0 0 512 512" aria-hidden="true"><path fill="${color}" transform="translate(-6 0)" d="${SPROUT_PATH}"/></svg>`); |
| 8 | |
| 9 | const ICONS: Record<string, string> = { |
| 10 | leaf: '<path d="M6 18 C5 10 10 5 19 5 C19 14 14 19 6 18Z"/><path d="M6 18 L13 11"/><path d="M6 18 L3.5 20.5"/>', |
| 11 | 'leaf-filled': '<path d="M6 18 C5 10 10 5 19 5 C19 14 14 19 6 18Z" fill="currentColor"/><path d="M6 18 L3.5 20.5"/>', |
| 12 | star: '<path d="M12 3.6l2.6 5.3 5.8.8-4.2 4.1 1 5.8L12 16.9 6.8 19.6l1-5.8L3.6 9.7l5.8-.8L12 3.6z"/>', |
| 13 | download: '<path d="M12 4v11"/><path d="M7.5 11 12 15.5 16.5 11"/><path d="M5 19.5h14"/>', |
| 14 | replant: '<path d="M12 21v-8"/><path d="M12 13c0-3-2-5-6-5 0 3 2 5 6 5z"/><path d="M12 11c0-3.5 2-6 6.5-6 0 3.500-2 6-6.5 6z"/><path d="M4 21h16"/>', |
| 15 | search: '<circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/>', |
| 16 | external: '<path d="M7 7h10v10"/><path d="M7 17 17 7"/>', |
| 17 | copy: '<rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V6a2 2 0 0 1 2-2h9"/>', |
| 18 | send: '<path d="M20.500 3.500 3.500 10l6.500 3.500L13.500 20l7-16.500z"/><path d="M10 13.500l10.500-10"/>', |
| 19 | help: '<circle cx="12" cy="12" r="8.500"/><path d="M9.500 9.500a2.500 2.500 0 1 1 3.500 2.300c-.700.400-1 1-1 1.700"/><path d="M12 16.500v.100"/>', |
| 20 | check: '<path d="M5 12.5l4.5 4.5L19 7.500"/>', |
| 21 | flag: '<path d="M6 21V4"/><path d="M6 5h11l-2 4 2 4H6"/>', |
| 22 | seed: '<path d="M12 21c-4.500 0-7-3.500-7-7.500C5 8 9 4 12 3c3 1 7 5 7 10.500 0 4-2.500 7.500-7 7.500z"/><path d="M12 21V11"/>', |
| 23 | shield: '<path d="M12 3l7 3v5.500c0 4.500-3 8-7 9.500-4-1.500-7-5-7-9.500V6l7-3z"/><path d="M9 12l2.200 2.200L15 10.500"/>', |
| 24 | fork: '<circle cx="7" cy="5.500" r="2"/><circle cx="17" cy="5.500" r="2"/><circle cx="12" cy="18.500" r="2"/><path d="M7 7.500v2a3 3 0 0 0 3 3h4a3 3 0 0 0 3-3v-2"/><path d="M12 12.500v4"/>', |
| 25 | clock: '<circle cx="12" cy="12" r="8.500"/><path d="M12 7.500V12l3 2"/>', |
| 26 | file: '<path d="M7 3.500h7l4 4V20a.5.5 0 0 1-.5.5h-10.500A.5.5 0 0 1 6.500 20V4a.5.5 0 0 1 .5-.5z"/><path d="M14 3.500V8h4"/>', |
| 27 | plug: '<path d="M9 3v5"/><path d="M15 3v5"/><path d="M6.500 8h11v3a5.500 5.500 0 0 1-11 0V8z"/><path d="M12 16.500V21"/>', |
| 28 | menu: '<path d="M4 7h16"/><path d="M4 12h16"/><path d="M4 17h16"/>', |
| 29 | share: '<circle cx="6.5" cy="12" r="2.3"/><circle cx="17" cy="6" r="2.3"/><circle cx="17" cy="18" r="2.3"/><path d="M8.6 10.900 14.900 7.200"/><path d="M8.6 13.100 14.900 16.800"/>', |
| 30 | comment: '<path d="M5 5h14a1.500 1.500 0 0 1 1.500 1.500v8A1.500 1.500 0 0 1 19 16h-7l-4 3.500V16H5a1.500 1.500 0 0 1-1.500-1.500v-8A1.500 1.500 0 0 1 5 5z"/>', |
| 31 | github: '', |
| 32 | google: '', |
| 33 | }; |
| 34 | |
| 35 | // Social marks, the same ones the other sites use. |
| 36 | const BRAND: Record<string, string> = { |
| 37 | x: '<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/>', |
| 38 | linkedin: '<path d="M20.45 20.45h-3.56v-5.57c0-1.33-.02-3.04-1.85-3.04-1.85 0-2.14 1.45-2.14 2.94v5.67H9.35V9h3.41v1.56h.05c.48-.9 1.64-1.85 3.37-1.85 3.6 0 4.27 2.37 4.27 5.46v6.28ZM5.34 7.43a2.06 2.06 0 1 1 0-4.13 2.06 2.06 0 0 1 0 4.13ZM7.12 20.45H3.56V9h3.56v11.45ZM22.22 0H1.77C.79 0 0 .77 0 1.73v20.54C0 23.23.79 24 1.77 24h20.45c.98 0 1.78-.77 1.78-1.73V1.73C24 .77 23.2 0 22.22 0Z"/>', |
| 39 | youtube: '<path fill-rule="evenodd" d="M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2 31.4 31.4 0 0 0 0 12a31.4 31.4 0 0 0 .5 5.8 3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1A31.4 31.4 0 0 0 24 12a31.4 31.4 0 0 0-.5-5.8ZM9.6 15.6V8.4l6.2 3.6-6.2 3.6Z"/>', |
| 40 | instagram: '<g fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="5"/><circle cx="12" cy="12" r="4"/></g><circle cx="17.5" cy="6.5" r="1.2"/>', |
| 41 | reddit: '<g fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="12" cy="14" rx="9" ry="6"/><path d="m13 8 1.5-5 4 1M3.5 11a2.5 2.5 0 1 0-2 4M20.5 11a2.5 2.5 0 1 1 2 4M8 16c2 2 6 2 8 0"/><circle cx="20" cy="4" r="2"/></g><circle cx="8" cy="13" r="1.3"/><circle cx="16" cy="13" r="1.3"/>', |
| 42 | substack: '<path d="M22.54 8.24H1.46V5.41h21.08v2.83ZM1.46 10.81V24L12 18.11 22.54 24V10.81H1.46ZM22.54 0H1.46v2.84h21.08V0Z"/>', |
| 43 | makerworld: '<g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></g>', |
| 44 | }; |
| 45 | |
| 46 | export function icon(name: string, size = 18, cls = '') { |
| 47 | if (BRAND[name]) return raw(`<svg class="${cls}" width="${size}" height="${size}" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">${BRAND[name]}</svg>`); |
| 48 | if (name === 'github') { |
| 49 | return raw(`<svg class="${cls}" width="${size}" height="${size}" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2C6.480 2 2 6.580 2 12.230c0 4.520 2.870 8.350 6.840 9.710.5.090.680-.220.680-.490 0-.240-.010-.880-.010-1.730-2.780.620-3.370-1.370-3.370-1.370-.450-1.180-1.110-1.500-1.110-1.500-.910-.640.070-.620.070-.620 1 .070 1.530 1.060 1.530 1.060.890 1.560 2.340 1.110 2.910.850.090-.660.350-1.110.630-1.370-2.220-.260-4.560-1.140-4.560-5.060 0-1.120.390-2.030 1.030-2.750-.100-.260-.450-1.300.100-2.710 0 0 .840-.270 2.750 1.050a9.360 9.360 0 0 1 5 0c1.910-1.320 2.750-1.050 2.750-1.050.550 1.410.200 2.450.100 2.710.640.720 1.030 1.630 1.030 2.750 0 3.930-2.340 4.800-4.570 5.050.360.320.680.940.680 1.900 0 1.370-.010 2.470-.010 2.810 0 .270.180.590.690.490A10.130 10.130 0 0 0 22 12.230C22 6.580 17.520 2 12 2z"/></svg>`); |
| 50 | } |
| 51 | if (name === 'google') { |
| 52 | return raw(`<svg class="${cls}" width="${size}" height="${size}" viewBox="0 0 24 24" aria-hidden="true"><path fill="#4285F4" d="M21.600 12.230c0-.680-.060-1.340-.170-1.970H12v3.730h5.380a4.600 4.600 0 0 1-2 3.020v2.510h3.230c1.890-1.740 2.990-4.310 2.990-7.290z"/><path fill="#34A853" d="M12 22c2.700 0 4.960-.900 6.620-2.430l-3.230-2.510c-.900.600-2.040.960-3.390.960-2.600 0-4.810-1.760-5.600-4.120H3.060v2.590A10 10 0 0 0 12 22z"/><path fill="#FBBC05" d="M6.400 13.900a6.010 6.010 0 0 1 0-3.800V7.510H3.060a10 10 0 0 0 0 8.980L6.400 13.900z"/><path fill="#EA4335" d="M12 5.980c1.470 0 2.790.510 3.820 1.500l2.870-2.870C16.950 2.990 14.700 2 12 2a10 10 0 0 0-8.940 5.510L6.400 10.100c.790-2.360 3-4.120 5.600-4.120z"/></svg>`); |
| 53 | } |
| 54 | const body = ICONS[name] ?? ''; |
| 55 | return raw(`<svg class="${cls}" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${body}</svg>`); |
| 56 | } |
| 57 | |
| 58 | // --------------------------------------------------------------------------- |
| 59 | // Illustration system. Everything below is built from four primitives on a |
| 60 | // fixed grid: the logo sprout, a two-arc leaf, circles and rounded rectangles. |
| 61 | // Flat fills only, at most two tones per glyph. |
| 62 | // --------------------------------------------------------------------------- |
| 63 | |
| 64 | const n = (v: number) => Math.round(v * 100) / 100; |
| 65 | |
| 66 | /** A leaf: two equal arcs between two points. `slim` > 0.71 makes it narrower. */ |
| 67 | function leaf(ax: number, ay: number, bx: number, by: number, slim = 0.76) { |
| 68 | const r = n(Math.hypot(bx - ax, by - ay) * slim); |
| 69 | return `M${n(ax)} ${n(ay)}A${r} ${r} 0 0 1 ${n(bx)} ${n(by)}A${r} ${r} 0 0 1 ${n(ax)} ${n(ay)}Z`; |
| 70 | } |
| 71 | |
| 72 | /** The logo sprout, centred on (cx, cy) and `h` units tall. */ |
| 73 | function sproutGlyph(cx: number, cy: number, h: number, color: string) { |
| 74 | const k = n(h / 410); |
| 75 | return `<path fill="${color}" transform="translate(${cx} ${cy}) scale(${k}) translate(-274 -275)" d="${SPROUT_PATH}"/>`; |
| 76 | } |
| 77 | |
| 78 | /** The Skillfarm mark as an app icon: cream sprout on a sage rounded square. */ |
| 79 | export function brandMark(size = 32, cls = '') { |
| 80 | return raw(`<svg class="brand-mark ${cls}" width="${size}" height="${size}" viewBox="0 0 512 512" aria-hidden="true"><rect width="512" height="512" rx="116" fill="#5A8A4A"/><rect x="6" y="6" width="500" height="500" rx="110" fill="none" stroke="#3F6B34" stroke-opacity=".55" stroke-width="12"/>${sproutGlyph(256, 256, 312, '#FFFBEF')}</svg>`); |
| 81 | } |
| 82 | |
| 83 | /** Homepage art: farm plots seen from above, each one a skill. */ |
| 84 | export function heroScene() { |
| 85 | const pill = (x: number, y: number, label: string) => { |
| 86 | const w = 30 + label.length * 7.6; |
| 87 | return `<g transform="translate(${x} ${y})"><rect width="${n(w)}" height="26" rx="13" fill="#FFFBEF"/><circle cx="13" cy="13" r="4" fill="#5A8A4A"/><text x="23" y="17.500" font-family="Figtree, system-ui, sans-serif" font-size="13" font-weight="700" fill="#3A1F0F">${label}</text></g>`; |
| 88 | }; |
| 89 | const tree = (x: number, y: number, r: number) => `<circle cx="${x}" cy="${y}" r="${r}" fill="#3F6B34"/>`; |
| 90 | return raw(`<svg class="hero-art" viewBox="0 0 720 540" role="img" aria-label="A flat illustration of farm plots seen from above: striped crop rows, a round irrigated field, a wheat field, an orchard, a pond and a barn. Small labels mark plots as skills."> |
| 91 | <defs> |
| 92 | <pattern id="hp-rows-a" x="24" width="16" height="16" patternUnits="userSpaceOnUse"><rect width="16" height="16" fill="#5A8A4A"/><rect width="6" height="16" fill="#6E9C5C"/></pattern> |
| 93 | <pattern id="hp-rows-b" y="206" width="16" height="16" patternUnits="userSpaceOnUse"><rect width="16" height="16" fill="#93B87A"/><rect width="16" height="8" fill="#A8C790"/></pattern> |
| 94 | <pattern id="hp-rows-c" x="467" width="14" height="14" patternUnits="userSpaceOnUse"><rect width="14" height="14" fill="#6E9C5C"/><rect width="5" height="14" fill="#5A8A4A"/></pattern> |
| 95 | <pattern id="hp-wheat" width="16" height="16" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="16" height="16" fill="#F2B93B"/><rect width="6" height="16" fill="#F6CC6A"/></pattern> |
| 96 | <pattern id="hp-soil" y="386" width="14" height="14" patternUnits="userSpaceOnUse"><rect width="14" height="14" fill="#8C5A3C"/><rect width="14" height="4" fill="#7A4B30"/></pattern> |
| 97 | <pattern id="hp-orchard" x="24" y="206" width="28" height="28" patternUnits="userSpaceOnUse"><rect width="28" height="28" fill="#DDEBC8"/><circle cx="14" cy="14" r="7" fill="#5A8A4A"/></pattern> |
| 98 | </defs> |
| 99 | <rect width="720" height="540" rx="28" fill="#EFE4C3"/> |
| 100 | <rect x="24" y="24" width="214" height="170" rx="14" fill="url(#hp-rows-a)"/> |
| 101 | <rect x="250" y="24" width="172" height="170" rx="14" fill="#BCD6A2"/> |
| 102 | <g transform="translate(336 109)"><circle r="72" fill="#5A8A4A"/><circle r="56" fill="#6E9C5C"/><circle r="40" fill="#5A8A4A"/><circle r="24" fill="#6E9C5C"/><path d="M0 0L50.900 -50.900" stroke="#FFFBEF" stroke-width="3" stroke-linecap="round"/><circle r="6" fill="#FFFBEF"/></g> |
| 103 | <rect x="434" y="24" width="262" height="170" rx="14" fill="url(#hp-wheat)"/> |
| 104 | <rect x="24" y="206" width="140" height="168" rx="14" fill="url(#hp-orchard)"/> |
| 105 | <rect x="176" y="206" width="300" height="168" rx="14" fill="url(#hp-rows-b)"/> |
| 106 | <rect x="488" y="206" width="208" height="168" rx="14" fill="#E3D3AB"/> |
| 107 | <g transform="translate(0 2)"> |
| 108 | <rect x="512" y="232" width="100" height="68" rx="6" fill="#C4552D"/><path d="M512 266h100v28a6 6 0 0 1-6 6h-88a6 6 0 0 1-6-6z" fill="#A8431F"/> |
| 109 | <circle cx="652" cy="266" r="24" fill="#FFFBEF"/><circle cx="652" cy="266" r="15" fill="#E3D7B8"/><circle cx="652" cy="266" r="5" fill="#FFFBEF"/> |
| 110 | <rect x="512" y="322" width="26" height="22" rx="5" fill="#F2B93B"/><rect x="546" y="322" width="26" height="22" rx="5" fill="#F2B93B"/><rect x="580" y="322" width="26" height="22" rx="5" fill="#F6CC6A"/> |
| 111 | ${tree(652, 330, 14)}${tree(676, 312, 9)} |
| 112 | </g> |
| 113 | <rect x="24" y="386" width="249" height="130" rx="14" fill="#BCD6A2"/> |
| 114 | <ellipse cx="118" cy="451" rx="58" ry="34" fill="#8DB7DA"/><ellipse cx="118" cy="451" rx="38" ry="20" fill="#A5C8E4"/> |
| 115 | ${tree(206, 424, 14)}${tree(236, 455, 10)}${tree(204, 484, 12)}${tree(52, 412, 9)} |
| 116 | <rect x="285" y="386" width="170" height="130" rx="14" fill="url(#hp-soil)"/> |
| 117 | <rect x="467" y="386" width="229" height="130" rx="14" fill="url(#hp-rows-c)"/> |
| 118 | ${pill(44, 44, 'pdf-forms')}${pill(454, 148, 'changelog')}${pill(196, 328, 'test-hunter')}${pill(305, 406, 'new plot')}${pill(560, 470, 'api-docs')} |
| 119 | </svg>`); |
| 120 | } |
| 121 | |
| 122 | /** One shallow hill between two flat colour fields. */ |
| 123 | export function hillEdge(fill: string, flip = false) { |
| 124 | return raw(`<svg class="hill-edge${flip ? ' flip' : ''}" viewBox="0 0 1440 64" preserveAspectRatio="none" aria-hidden="true"><path fill="${fill}" d="M0 64V48Q720 -32 1440 48V64Z"/></svg>`); |
| 125 | } |
| 126 | |
| 127 | // Tier badges: one round seal per tier, one glyph each, drawn on a 64 grid. |
| 128 | const stem = (top: number, bottom: number, color: string) => `<rect x="30.500" y="${top}" width="3" height="${bottom - top}" rx="1.500" fill="${color}"/>`; |
| 129 | const pair = (y: number, dx: number, dy: number, color: string, slim = 0.76) => |
| 130 | `<path fill="${color}" d="${leaf(32, y, 32 - dx, y - dy, slim)}${leaf(32 + dx, y - dy, 32, y, slim)}"/>`; |
| 131 | |
| 132 | const TIER_ART: Record<string, { tint: string; ink: string; glyph: string }> = { |
| 133 | seedling: { tint: '#E4EFD3', ink: '#5A8A4A', glyph: sproutGlyph(32, 32.500, 30, '#5A8A4A') }, |
| 134 | grower: { |
| 135 | tint: '#CFE2B8', ink: '#3F6B34', |
| 136 | glyph: `${stem(20, 50, '#3F6B34')}${pair(44, 13, 9, '#3F6B34')}${pair(33, 11, 8, '#3F6B34')}<path fill="#3F6B34" d="${leaf(32, 24, 32, 11, 0.68)}"/>`, |
| 137 | }, |
| 138 | farmer: { |
| 139 | tint: '#FBE7B2', ink: '#9A5F10', |
| 140 | glyph: `<rect x="24" y="12" width="16" height="3.500" rx="1.750" fill="#9A5F10"/><rect x="30.250" y="12" width="3.500" height="24" rx="1.750" fill="#9A5F10"/><path fill="#9A5F10" d="M23 33h18v8.500c0 5.500-4 9.500-9 11.500c-5-2-9-6-9-11.500z"/>`, |
| 141 | }, |
| 142 | harvester: { |
| 143 | tint: '#F8D5C4', ink: '#B5471F', |
| 144 | glyph: `${stem(24, 52, '#B5471F')}${pair(47, 9, 8, '#B5471F', 0.9)}${pair(39, 9, 8, '#B5471F', 0.9)}${pair(31, 9, 8, '#B5471F', 0.9)}<path fill="#B5471F" d="${leaf(32, 25, 32, 11, 0.8)}"/>`, |
| 145 | }, |
| 146 | homesteader: { |
| 147 | tint: '#EAD3C3', ink: '#6E2F1B', |
| 148 | glyph: `<path fill="#6E2F1B" d="M15 33l4.500-11L32 13l12.500 9L49 33z"/><rect x="18" y="33" width="28" height="18" fill="#8C4A2F"/><rect x="27" y="39" width="10" height="12" rx="1.500" fill="#EAD3C3"/><circle cx="32" cy="25" r="3.200" fill="#EAD3C3"/>`, |
| 149 | }, |
| 150 | 'blue-ribbon': { |
| 151 | tint: '#D5E3F4', ink: '#2F5C94', |
| 152 | glyph: `<path fill="#3F74B5" d="M24 34l8 3-4 16-3.500-4.500L20 51z"/><path fill="#3F74B5" d="M40 34l-8 3 4 16 3.500-4.500L44 51z"/><g fill="#2F5C94">${Array.from({ length: 12 }, (_, i) => `<circle cx="${n(32 + 11.500 * Math.cos((i * Math.PI) / 6))}" cy="${n(26 + 11.500 * Math.sin((i * Math.PI) / 6))}" r="3.800"/>`).join('')}<circle cx="32" cy="26" r="12"/></g><circle cx="32" cy="26" r="7.500" fill="#D5E3F4"/>${sproutGlyph(32, 26, 9.500, '#2F5C94')}`, |
| 153 | }, |
| 154 | }; |
| 155 | |
| 156 | export function tierArt(key: string, size = 40) { |
| 157 | const t = TIER_ART[key] ?? TIER_ART.seedling; |
| 158 | return raw(`<svg class="tier-art" width="${size}" height="${size}" viewBox="0 0 64 64" aria-hidden="true"><circle cx="32" cy="32" r="32" fill="${t.tint}"/><circle cx="32" cy="32" r="30.500" fill="none" stroke="${t.ink}" stroke-opacity=".22" stroke-width="1.500"/>${t.glyph}</svg>`); |
| 159 | } |
| 160 | |
| 161 | const AVATAR_TINTS = [ |
| 162 | ['#CFE2B8', '#3F6B34'], ['#FBE7B2', '#8C4A2F'], ['#F8D5C4', '#8C3B22'], ['#D5E3F4', '#2F5C94'], ['#DDEBE3', '#3F6B34'], ['#EAD3C3', '#6E2F1B'], |
| 163 | ]; |
| 164 | |
| 165 | /** Default avatar: a sprout on a flat tint chosen from the member id. */ |
| 166 | export function defaultAvatar(seed: string, size: number) { |
| 167 | let h = 0; |
| 168 | for (let i = 0; i < seed.length; i++) h = (h * 31 + seed.charCodeAt(i)) >>> 0; |
| 169 | const [bg, fg] = AVATAR_TINTS[h % AVATAR_TINTS.length]; |
| 170 | return raw(`<svg class="avatar" width="${size}" height="${size}" viewBox="0 0 48 48" aria-hidden="true"><rect width="48" height="48" fill="${bg}"/>${sproutGlyph(24, 24.500, 26, fg)}</svg>`); |
| 171 | } |
| 172 | |
| 173 | const drop = (x: number, y: number, color: string) => |
| 174 | `<path fill="${color}" d="M${x} ${y - 8}C${x + 2.500} ${y - 4} ${x + 5.500} ${y - 1} ${x + 5.500} ${y + 2.500}A5.500 5.500 0 0 1 ${x - 5.500} ${y + 2.500}C${x - 5.500} ${y - 1} ${x - 2.500} ${y - 4} ${x} ${y - 8}Z"/>`; |
| 175 | |
| 176 | /** Spot icons: a rounded-square tile with one glyph, on a 72 grid. */ |
| 177 | export function spot(name: 'plant' | 'tend' | 'harvest' | 'empty' | 'mcp' | 'news' | 'coffee') { |
| 178 | const ground = (color: string) => `<rect x="14" y="52" width="44" height="6" rx="3" fill="${color}"/>`; |
| 179 | const art: Record<string, string> = { |
| 180 | plant: `<rect width="72" height="72" rx="18" fill="#FBE7B2"/>${ground('#8C5A3C')}<path fill="#B5471F" d="${leaf(36, 40, 36, 16, 0.62)}"/><circle cx="36" cy="46.500" r="1.800" fill="#8C5A3C"/>`, |
| 181 | tend: `<rect width="72" height="72" rx="18" fill="#D9E8F2"/>${ground('#8C5A3C')}${sproutGlyph(36, 39, 24, '#5A8A4A')}${drop(18, 26, '#3F74B5')}${drop(54, 26, '#3F74B5')}${drop(36, 16, '#3F74B5')}`, |
| 182 | harvest: `<rect width="72" height="72" rx="18" fill="#F8D5C4"/><circle cx="36" cy="42" r="15" fill="#C4552D"/><rect x="34.500" y="19" width="3" height="10" rx="1.500" fill="#6E2F1B"/><path fill="#5A8A4A" d="${leaf(37, 24, 50, 15, 0.74)}"/>`, |
| 183 | empty: `<rect width="72" height="72" rx="18" fill="#F0E6C8"/><rect x="15" y="19" width="42" height="34" rx="9" fill="none" stroke="#A98F68" stroke-width="2.500" stroke-dasharray="5 6" stroke-linecap="round"/><path fill="#8C5A3C" d="${leaf(31, 42, 41, 30, 0.74)}"/>`, |
| 184 | news: `<rect width="72" height="72" rx="18" fill="#FBE7B2"/><rect x="13" y="21" width="46" height="32" rx="7" fill="#FFFBEF"/><path fill="#E9A23B" d="M13 28a7 7 0 0 1 7-7h32a7 7 0 0 1 7 7v.500L38.900 41.800a5 5 0 0 1-5.800 0L13 28.500z"/>`, |
| 185 | coffee: `<rect width="72" height="72" rx="18" fill="#EAD3C3"/><path fill="#6E2F1B" d="M17 30h30v14a12 12 0 0 1-12 12h-6a12 12 0 0 1-12-12z"/><path fill="none" stroke="#6E2F1B" stroke-width="4" d="M47 34h3.500a6.500 6.500 0 0 1 0 13H46"/><rect x="24.500" y="15" width="3.500" height="10" rx="1.750" fill="#B5471F"/><rect x="36" y="15" width="3.500" height="10" rx="1.750" fill="#B5471F"/>`, |
| 186 | mcp: `<rect width="72" height="72" rx="18" fill="#5A8A4A"/><rect x="12" y="17" width="48" height="38" rx="8" fill="#FFFBEF"/><path d="M22 29l7 7-7 7" stroke="#3A1F0F" stroke-width="3.500" fill="none" stroke-linecap="round" stroke-linejoin="round"/><path d="M35 43h13" stroke="#5A8A4A" stroke-width="3.500" stroke-linecap="round"/>`, |
| 187 | }; |
| 188 | return raw(`<svg class="spot" width="72" height="72" viewBox="0 0 72 72" aria-hidden="true">${art[name]}</svg>`); |
| 189 | } |