CheerLights Change the color

The CheerLights color right now

…  

Connecting to wss.cheerlights.com…

Since You Opened This Page

Each bulb is a color this page received. When anyone changes the CheerLights color, a new bulb lights here, and lights around the world change with it.

    What Arrives

    This page keeps one WebSocket open to wss://wss.cheerlights.com. The first message is the current color, and a new one arrives each time the color changes. This is the last one it received:

    …

    Plain JSON, no library needed. New fields may be added later, so ignore the ones you do not use.

    Put It on Your Page

    Paste this into any web page. It turns the page the CheerLights color and follows every change.

    <script>
      function follow() {
        const feed = new WebSocket("wss://wss.cheerlights.com");
        feed.onmessage = (e) => (document.body.style.background = JSON.parse(e.data).hex);
        feed.onclose = () => setTimeout(follow, 5000);
      }
      follow();
    </script>

    Even Shorter: Server-Sent Events

    If your page only listens, EventSource does the same in one line and reconnects by itself.

    <script>
      new EventSource("https://wss.cheerlights.com").onmessage = (e) =>
        (document.body.style.background = JSON.parse(e.data).hex);
    </script>

    Check the Color Once

    To check the color once, ask for it: fetch("https://wss.cheerlights.com") answers with the same JSON.

    Outside the Browser

    The full description of the feed is in docs/protocol.md.

    Change the Color

    Type /cheerlights on the CheerLights Discord and pick a color, or post on Bluesky with #cheerlights and a color. This page changes a moment later.