mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-26 01:14:25 +01:00
added brightness
This commit is contained in:
@@ -19,6 +19,12 @@ def pos_to_color(x, y):
|
||||
rgb = hsv2rgb(hsv[0],hsv[1],hsv[2])
|
||||
return rgb
|
||||
|
||||
def rgb_brightness(rgb_color, brightness):
|
||||
red = rgb_color[0]/255*brightness
|
||||
green = rgb_color[1]/255*brightness
|
||||
blue = rgb_color[2]/255*brightness
|
||||
return [red, green, blue]
|
||||
|
||||
def rgb_dec565(rgb_color):
|
||||
red = rgb_color[0]
|
||||
green = rgb_color[1]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import json
|
||||
import datetime
|
||||
import hassapi as hass
|
||||
from color import pos_to_color, rgb_dec565
|
||||
from color import pos_to_color, rgb_dec565, rgb_brightness
|
||||
|
||||
# check Babel
|
||||
import importlib
|
||||
@@ -367,7 +367,10 @@ class NsPanelLovelaceUI:
|
||||
icon_color = 17299
|
||||
|
||||
if "rgb_color" in entity.attributes:
|
||||
icon_color = rgb_dec565(entity.attributes.rgb_color)
|
||||
color = entity.attributes.rgb_color
|
||||
if "brightness" in entity.attributes:
|
||||
color = rgb_brightness(color, entity.attributes.brightness)
|
||||
icon_color = rgb_dec565(color)
|
||||
|
||||
return f",{item_type},{item},1,{icon_color},{name},{switch_val}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user