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.
You can install the package using pip:
pip install cheerlights_apiimportcheerlights_api# Get the current color name and hex codecurrent_color=cheerlights_api.get_current_color()
print(current_color) # Example: {'color': 'red', 'hex': '#FF0000'}# Get the current color namecolor_name=cheerlights_api.get_current_color_name()
print(color_name) # Example: 'red'# Get the current hex codehex_code=cheerlights_api.get_current_hex()
print(hex_code) # Example: '#FF0000'# Get the history of colorshistory=cheerlights_api.get_color_history(5)
forentryinhistory:
print(f"{entry['timestamp']}: {entry['color']} ({entry['hex']})")
# Convert a color name to hexhex_code=cheerlights_api.color_name_to_hex('green')
print(hex_code) # '#00FF00'# Convert hex code to RGBrgb=cheerlights_api.hex_to_rgb('#00FF00')
print(rgb) # (0, 255, 0)# Check if a color is validis_valid=cheerlights_api.is_valid_color('purple')
print(is_valid) # True