private updateNeoPixels()

in sim/visuals/board.ts [477:506]


        private updateNeoPixels() {
            const state = this.board;
            if (!state) return;
            const neopixelState = state.tryGetNeopixelState(state.defaultNeopixelPin().id);
            if (!neopixelState) return;
            const n = Math.min(10, neopixelState.length);
            for (let i = 0; i < n; i++) {
                let rgb = neopixelState.pixelColor(i);
                let p_inner = this.element.getElementById(`LED${i}`) as SVGPathElement;
                if (!p_inner) continue;

                if (!rgb || (rgb.length == 3 && rgb[0] == 0 && rgb[1] == 0 && rgb[2] == 0)) {
                    // Clear the pixel
                    svg.fill(p_inner, `rgb(200,200,200)`);
                    svg.filter(p_inner, null);
                    p_inner.style.stroke = `none`
                    continue;
                }

                let hsl = visuals.rgbToHsl([rgb[0], rgb[1], rgb[2]]);
                let [h, s, l] = hsl;
                let lx = Math.max(l * 1.3, 85);
                // at least 10% luminosity
                l = l * 90 / 100 + 10;
                p_inner.style.stroke = `hsl(${h}, ${s}%, ${Math.min(l * 3, 75)}%)`
                p_inner.style.strokeWidth = "1.5";
                svg.fill(p_inner, `hsl(${h}, ${s}%, ${lx}%)`)
                svg.filter(p_inner, `url(#neopixelglow)`);
            }
        }