Added support for setting/getting the white color temperature and a utility function to convert from Kelvin to MIRED

This commit is contained in:
Julian Müller (ChaoticByte) 2023-07-23 10:32:00 +02:00
parent 9b99902463
commit ed75cd2951
4 changed files with 92 additions and 0 deletions

View file

@ -13,3 +13,8 @@ def rgb_to_hsv(r:int, g:int, b:int) -> tuple:
g_ = g / 255.0
b_ = b / 255.0
return _rgb_to_hsv(r_, g_, b_)
def kelvin_to_mired(kelvin:int):
'''Convert the color temperature from Kelvin to Mired'''
assert type(kelvin) == int
return round(1000000.0/kelvin)