From 90210ae98630400c8dc18448629e75430b70bb18 Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Sun, 10 Nov 2024 22:02:46 +0100 Subject: [PATCH] Fix hsbToRgb util & Fix conversion in oh-canvas-embedded-svg-mixin.js (#2866) Signed-off-by: Florian Hotze --- .../widgets/layout/oh-canvas-embedded-svg-mixin.js | 2 +- bundles/org.openhab.ui/web/src/js/openhab/utils.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/components/widgets/layout/oh-canvas-embedded-svg-mixin.js b/bundles/org.openhab.ui/web/src/components/widgets/layout/oh-canvas-embedded-svg-mixin.js index d40b987a0a..db18c729e6 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/layout/oh-canvas-embedded-svg-mixin.js +++ b/bundles/org.openhab.ui/web/src/components/widgets/layout/oh-canvas-embedded-svg-mixin.js @@ -227,7 +227,7 @@ export default { console.info(`invalid rgb values in configured color: ${color}`) return '#FF0000' // not valid returns red } - const rgb = this.$oh.utils.hsbToRgb(rgbNumbers[0], rgbNumbers[1], rgbNumbers[2]) + const rgb = this.$oh.utils.hsbToRgb(rgbNumbers[0], rgbNumbers[1] / 100, rgbNumbers[2] / 100) return `rgb(${rgb[0]},${rgb[1]},${rgb[2]})` } } else { diff --git a/bundles/org.openhab.ui/web/src/js/openhab/utils.js b/bundles/org.openhab.ui/web/src/js/openhab/utils.js index 557ca497c2..5e5f27109b 100644 --- a/bundles/org.openhab.ui/web/src/js/openhab/utils.js +++ b/bundles/org.openhab.ui/web/src/js/openhab/utils.js @@ -1,3 +1,4 @@ +import Framework7 from 'framework7' import diacritic from 'diacritic' export default { @@ -13,7 +14,7 @@ export default { * @returns {number[]} [r, g, b] array */ hsbToRgb (h, s, b) { - const hsl = this.$f7.utils.colorHsbToHsl(h, s, b) - return this.$f7.utils.colorHslToRgb(hsl[0], hsl[1], hsl[2]) + const hsl = Framework7.utils.colorHsbToHsl(h, s, b) + return Framework7.utils.colorHslToRgb(hsl[0], hsl[1], hsl[2]) } }