A Python package to interact with the CheerLights API.
Project description
CheerLights API Python Package
A Python package to interact with the CheerLights API. It allows users to get the current CheerLights color, retrieve the color history, and perform various color-related utilities.
Installation
You can install the package using pip:
pip install cheerlights_api
Usage Examples
import cheerlights_api
# Get the current color name and hex code
current_color = cheerlights_api.get_current_color()
print(current_color) # Example: {'color': 'red', 'hex': '#FF0000'}
# Get the current color name
color_name = cheerlights_api.get_current_color_name()
print(color_name) # Example: 'red'
# Get the current hex code
hex_code = cheerlights_api.get_current_hex()
print(hex_code) # Example: '#FF0000'
# Get the history of colors
history = cheerlights_api.get_color_history(5)
for entry in history:
print(f"{entry['timestamp']}: {entry['color']} ({entry['hex']})")
# Convert a color name to hex
hex_code = cheerlights_api.color_name_to_hex('green')
print(hex_code) # '#00FF00'
# Convert hex code to RGB
rgb = cheerlights_api.hex_to_rgb('#00FF00')
print(rgb) # (0, 255, 0)
# Check if a color is valid
is_valid = cheerlights_api.is_valid_color('purple')
print(is_valid) # True
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cheerlights_api-0.1.2.tar.gz
(3.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cheerlights_api-0.1.2.tar.gz.
File metadata
- Download URL: cheerlights_api-0.1.2.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff6c57d5481c05d034bc85c4d2f5a7e8463db8ef67381c0e3e7bb0b0353dd0c6
|
|
| MD5 |
929aa0a86b30cbc5f8893b3789fca706
|
|
| BLAKE2b-256 |
9e37e7c14e667d2e4917aa188dad3a03190746ca9830b5efc231345aa8a70041
|
File details
Details for the file cheerlights_api-0.1.2-py3-none-any.whl.
File metadata
- Download URL: cheerlights_api-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2160fd3d6edf1c56c6fdda62d06f756ec33f974fd7a1afebca8b8e0d5d099353
|
|
| MD5 |
0693edd0bb25bf30efb5c960f4ee165d
|
|
| BLAKE2b-256 |
dcb75939cd0c06436ff52d6fd5e796404688cb0b2114a1f6da8aa409920f2e0a
|