RGB conversion tool written in Python for Philips Hue.
Project description
# Philips Hue Python RGB / CIE1931 "xy" Converter
RGB conversion tool written in Python for Philips Hue.
```python
In [1]: from rgb_xy import Converter
In [2]: converter = Converter()
In [3]: converter.hex_to_xy('bada55')
Out[3]: [0.3991853917195425, 0.498424689144739]
In [4]: converter.rgb_to_xy(255, 0, 0)
Out[4]: [0.6484272236872118, 0.330856101472778]
In [5]: converter.get_random_xy_color()
Out[5]: [0.3706941388849757, 0.19786410488389355]
In [6]: converter.xy_to_hex(0.3991853917195425, 0.498424689144739, bri=0.8)
Out[6]: 'e9e860'
```
## Gamuts
The conversion tool support three gamuts: Gamut A, B, and C, [documented here](http://www.developers.meethue.com/documentation/supported-lights). Use them as follows:
```python
from rgb_xy import Converter
from rgb_xy import GamutA # or GamutB, GamutC
converter = Converter(GamutA)
```
If no gamut is specified, defaults to Gamut B (A19 Gen 1 Hue bulbs).
RGB conversion tool written in Python for Philips Hue.
```python
In [1]: from rgb_xy import Converter
In [2]: converter = Converter()
In [3]: converter.hex_to_xy('bada55')
Out[3]: [0.3991853917195425, 0.498424689144739]
In [4]: converter.rgb_to_xy(255, 0, 0)
Out[4]: [0.6484272236872118, 0.330856101472778]
In [5]: converter.get_random_xy_color()
Out[5]: [0.3706941388849757, 0.19786410488389355]
In [6]: converter.xy_to_hex(0.3991853917195425, 0.498424689144739, bri=0.8)
Out[6]: 'e9e860'
```
## Gamuts
The conversion tool support three gamuts: Gamut A, B, and C, [documented here](http://www.developers.meethue.com/documentation/supported-lights). Use them as follows:
```python
from rgb_xy import Converter
from rgb_xy import GamutA # or GamutB, GamutC
converter = Converter(GamutA)
```
If no gamut is specified, defaults to Gamut B (A19 Gen 1 Hue bulbs).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rgbxy-0.4.tar.gz
(4.8 kB
view details)
File details
Details for the file rgbxy-0.4.tar.gz
.
File metadata
- Download URL: rgbxy-0.4.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af22ad52ed8fc649d1ee2fc01b5d4f8d136cb1e492ebb3280592f1bc0ec9dba2 |
|
MD5 | 0ff12b8b7b2ac82cb1ca473ca6b8ce70 |
|
BLAKE2b-256 | 3325ecd310b577c7f8d65c527cdba3de670678c2b34dd16b027de6358fc9e4c4 |