diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/Light.vue b/platypush/backend/http/webapp/src/components/panels/Entities/Light.vue new file mode 100644 index 000000000..9c7dc7b41 --- /dev/null +++ b/platypush/backend/http/webapp/src/components/panels/Entities/Light.vue @@ -0,0 +1,212 @@ + + + + + diff --git a/platypush/backend/http/webapp/src/components/panels/Light/color.js b/platypush/backend/http/webapp/src/components/panels/Light/color.js index f74464346..775df1b94 100644 --- a/platypush/backend/http/webapp/src/components/panels/Light/color.js +++ b/platypush/backend/http/webapp/src/components/panels/Light/color.js @@ -211,4 +211,21 @@ export class ColorConverter { console.debug('Could not determine color space') console.debug(color) } + + hexToRgb(hex) { + return [ + hex.slice(1, 3), + hex.slice(3, 5), + hex.slice(5, 7), + ].map(_ => parseInt(_, 16)) + } + + rgbToHex(rgb) { + return '#' + rgb.map((x) => { + let hex = x.toString(16) + if (hex.length < 2) + hex = '0' + hex + return hex + }).join('') + } }