98_DOIF.pm: color function: lightness difference

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@24399 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Damian 2021-05-08 13:47:37 +00:00
parent cd470a6c98
commit 42b919fb4e

View File

@ -5124,14 +5124,17 @@ sub color {
return ($hue); return ($hue);
} }
my $l; my $l;
my $diff;
if (defined $lightness and $lightness ne "") { if (defined $lightness and $lightness ne "") {
$l=$lightness; $diff=$lightness-50;
} else { } else {
if ($hue>180 and $hue<290) { $diff=0;
$l=70;
} else {
$l=50;
} }
if ($hue>180 and $hue<290) {
$l=70+$diff;
} else {
$l=50+$diff;
} }
return ("hsl($hue,100%,".$l."%)"); return ("hsl($hue,100%,".$l."%)");
} }