A Python package to interact with the CheerLights API.
Project description
CheerLights 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.1.tar.gz
(3.9 kB
view details)
Built Distribution
File details
Details for the file cheerlights_api-0.1.1.tar.gz
.
File metadata
- Download URL: cheerlights_api-0.1.1.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 | fca3f997054447279609c71a8188422c0c02692e007e83544a3915890b216876 |
|
MD5 | 9fc635124a93a408f90bddf8d7745186 |
|
BLAKE2b-256 | 70e0aa0e2ecb28207dd9eb26949c8e4741dcdc77fb40513f5e19c14e6901c9a2 |
File details
Details for the file cheerlights_api-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: cheerlights_api-0.1.1-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 | fd34ff4517b781b491e060b55d0bbc66caba7fedf1b832c5d174d1f596dccbf1 |
|
MD5 | f1009b330da2e38454cf3a2bc633245a |
|
BLAKE2b-256 | aaef1a5ee66a5545353be952dad85c665637069e4648e32c1a1a01ef7ac057a4 |