update favicon to match active color
Hunter
Wednesday, April 15th, 2026 at 3:58 PM
3 <head>
4 <meta charset="UTF-8">
5 <title>paint</title>
6 +<link id="favicon" rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1 1'%3E%3Crect width='1' height='1' fill='white'/%3E%3C/svg%3E">
7 <style>
8 html, body {
9 margin: 0;
184 }
185 }
186
187 + const faviconEl = document.getElementById('favicon');
188 + function updateFavicon() {
189 + const svg = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1 1'><rect width='1' height='1' fill='rgb(" + r + "," + g + "," + b + ")'/></svg>";
190 + faviconEl.href = 'data:image/svg+xml,' + encodeURIComponent(svg);
191 + }
192 +
193 function pickAt(cx, cy) {
194 const c = readPixel(cx, cy);
195 r = c[0]; g = c[1]; b = c[2];
196 setOutlineTarget((r + g + b > 384) ? 1 : 0);
197 setDisplayColorTarget(r, g, b);
198 + updateFavicon();
199 }
200
201 function setColor(nr, ng, nb) {
202 r = nr; g = ng; b = nb;
203 setOutlineTarget((r + g + b > 384) ? 1 : 0);
204 + updateFavicon();
205 // direct color edits snap the display immediately (no transition)
206 dispR = r; dispG = g; dispB = b;
207 colorAnimFromR = r; colorAnimFromG = g; colorAnimFromB = b;