CheerLights API for Python
A small Python package that reads the live CheerLights color, its recent history, and the CheerLights palette.
CheerLights is a global network of lights that all show the same color, set by anyone on the CheerLights Discord.
This package reads the public CheerLights feed (ThingSpeak channel 1417), so a Python script on a laptop or a Raspberry Pi can follow the color.
It needs no API key and depends only on requests.
Quick start
Install it from PyPI (Python 3.10 or later):
pip install cheerlights-api
Then read the current color:
import cheerlights_api
print(cheerlights_api.get_current_color())
Example
import cheerlights_api
current = cheerlights_api.get_current_color()
print(current)
print(cheerlights_api.hex_to_rgb(current["hex"]))
for change in cheerlights_api.get_color_history(3):
print(change)
Output from version 0.2.0 on 2026-10-29:
{'color': 'red', 'hex': '#ff0000'}
(255, 0, 0)
{'color': 'cyan', 'hex': '#00ffff', 'timestamp': '2026-10-29T17:01:36Z'}
{'color': 'purple', 'hex': '#800080', 'timestamp': '2026-10-29T17:20:53Z'}
{'color': 'red', 'hex': '#ff0000', 'timestamp': '2026-10-29T18:00:53Z'}
The (255, 0, 0) tuple is what an RGB LED or a NeoPixel library takes.
Features
- The current color as a name and a HEX value:
get_current_color(),get_current_color_name(),get_current_hex(). - The last 1 to 8000 color changes with the time each was set, oldest first:
get_color_history(count). - The 11 official CheerLights colors with their HEX values, as the feed publishes them:
COLORS. - Name and HEX helpers:
color_name_to_hex("Old Lace")gives#fdf5e6,hex_to_rgb("#ffa500")gives(255, 165, 0),is_valid_color("pink")givesTrue. - Type hints throughout, checked with mypy in strict mode.
- A 10 second timeout on every request, and clear errors:
requestsexceptions when the feed cannot be reached,LookupErrorwhen it returns no color,ValueErrorfor bad input.
Limits
- It reads the color; it cannot set it. Anyone sets the color with the
/cheerlightscommand on the CheerLights Discord. - It polls the feed. For a light that changes the moment the color does, subscribe to MQTT instead: broker
mqtt.cheerlights.com, port 1883, topiccheerlightsfor the name orhexfor the HEX value. - History comes back oldest first, the order the feed returns it.
Documentation
- Reference: every function, its return value, and its errors.
- Changes in 0.2.0: what changed from 0.1.2, including the fixed green and lowercase HEX values.
- CheerLights: the project, the feeds, and how to build your first light.
Development
git clone https://github.com/cheerlights/cheerlights-python-package
cd cheerlights-python-package
uv sync
uv run pytest # offline, against a fake feed
uv run pytest -m live # one check against the real feed
uv run ruff check . && uv run mypy src
License
MIT. See LICENSE.
Metadata
Release files for cheerlights-api 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cheerlights_api-0.2.0.tar.gz | 62.0 kB | With provenance | Details for cheerlights_api-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cheerlights_api-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for cheerlights_api-0.2.0-py3-none-any.whl |
Total release size: 68.0 kB
Release files / cheerlights_api-0.2.0.tar.gz
| Download URL | cheerlights_api-0.2.0.tar.gz |
|---|---|
| Size | 62.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
905debcc69a5929c9fa729efeab5f459620e7912dff7536134d86e5ecf10dabe
|
|
BLAKE2b-256 checksum How to use checksums |
ec6a1969b91f40d81faac39cc54ec433ec2939ba8be93219ae3ae24deb062f99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / cheerlights_api-0.2.0-py3-none-any.whl
| Download URL | cheerlights_api-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cecc6090107ab24c8260d9840a54d17eab20dcf5a4fcc4c69a72a909fdd8787d
|
|
BLAKE2b-256 checksum How to use checksums |
ea511da51f4eef7e4ef588aa697382135bc03db0b75dfb794d55ac9af0219218
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for cheerlights-api 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cheerlights_api-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.