From 1eb4ac7f3457b83313895e48880c1cb81edf2070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Fri, 19 Oct 2018 00:01:23 +0200 Subject: [PATCH] Safer brightness calculation for icons --- src/components/entity/state-badge.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/entity/state-badge.js b/src/components/entity/state-badge.js index f0b1124bed..5c293c5261 100644 --- a/src/components/entity/state-badge.js +++ b/src/components/entity/state-badge.js @@ -89,7 +89,7 @@ class StateBadge extends PolymerElement { if (newVal.attributes.brightness) { const brightness = newVal.attributes.brightness; // lowest brighntess will be around 50% (that's pretty dark) - iconStyle.filter = `brightness(${(brightness + 245) / 5}%)`; + iconStyle.filter = `brightness(${(parseInt(brightness) + 245) / 5}%)`; } } Object.assign(this.$.icon.style, iconStyle);