From 49be931f53b321bdeb8c40c5489efe8f56b665cf Mon Sep 17 00:00:00 2001 From: Laurent Garnier Date: Sun, 12 Nov 2023 19:57:48 +0100 Subject: [PATCH 1/2] Add color utils actions Related to openhab/openhab-core#3749 Signed-off-by: Laurent Garnier --- addons/actions.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/addons/actions.md b/addons/actions.md index dc949c7ebf..568d3f9019 100644 --- a/addons/actions.md +++ b/addons/actions.md @@ -202,6 +202,19 @@ if ((thingStatusInfo !== null) && (thingStatusInfo.getStatus().toString() == "ON } ``` +### Color utilities + +- `int[] hsbToRgb(HSBType hsb)`: transforms HSB to RGB returning an array of three int with the RGB values in the range 0 to 255 +- `PercentType[] hsbToRgbPercent(HSBType hsb)`: transforms HSB to RGB returning an array of three PercentType with the RGB values in the range 0 to 100 percent +- `int hsbTosRgb(HSBType hsb)`: transforms HSB to the RGB value of the color in the default sRGB color model (Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue) +- `double[] hsbToXY(HSBType hsb)`: transforms HSB to CIE 1931 "xy" format using default color Gamut, returning an array of three double with the closest matching CIE 1931 x,y,Y in the range 0.0000 to 1.0000 +- `double[] hsbToXY(HSBType hsb, double[] gamutR, double[] gamutG, double[] gamutB)`: transforms HSB to CIE 1931 "xy" format using specific color Gamut, returning an array of three double with the closest matching CIE 1931 x,y,Y in the range 0.0000 to 1.0000 +- `HSBType rgbToHsb(int[] rgb)`: transforms RGB (array of three or four int with the RGB(W) values in the range 0 to 255) to HSB +- `HSBType rgbToHsb(PercentType[] rgb)`: transforms RGB (array of three PercentType with the RGB values in the range 0 to 100 percent) to HSB +- `HSBType xyToHsb(double[] xy)`: transforms CIE 1931 "xy" format (array of double with CIE 1931 x,y[,Y] in the range 0.0000 to 1.0000 with Y being optional) to HSB using default color Gamut +- `HSBType xyToHsb(double[] xy, double[] gamutR, double[] gamutG, double[] gamutB)`: transforms CIE 1931 "xy" format (array of double with CIE 1931 x,y[,Y] in the range 0.0000 to 1.0000 with Y being optional) to HSB using specific color Gamut + + ### openHAB Subsystem Actions openHAB has several subsystems that can be accessed from Rules. These include persistence, see [Persistence Extensions in Scripts and Rules]({{base}}/configuration/persistence.html#persistence-extensions-in-scripts-and-rules), transformations, scripts. From f7ca88cebb29ad1294f001675b8195e128f3e5b9 Mon Sep 17 00:00:00 2001 From: Laurent Garnier Date: Sat, 18 Nov 2023 19:41:28 +0100 Subject: [PATCH 2/2] Review comment: remove a blank line Signed-off-by: Laurent Garnier --- addons/actions.md | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/actions.md b/addons/actions.md index 568d3f9019..b46b4558e5 100644 --- a/addons/actions.md +++ b/addons/actions.md @@ -214,7 +214,6 @@ if ((thingStatusInfo !== null) && (thingStatusInfo.getStatus().toString() == "ON - `HSBType xyToHsb(double[] xy)`: transforms CIE 1931 "xy" format (array of double with CIE 1931 x,y[,Y] in the range 0.0000 to 1.0000 with Y being optional) to HSB using default color Gamut - `HSBType xyToHsb(double[] xy, double[] gamutR, double[] gamutG, double[] gamutB)`: transforms CIE 1931 "xy" format (array of double with CIE 1931 x,y[,Y] in the range 0.0000 to 1.0000 with Y being optional) to HSB using specific color Gamut - ### openHAB Subsystem Actions openHAB has several subsystems that can be accessed from Rules. These include persistence, see [Persistence Extensions in Scripts and Rules]({{base}}/configuration/persistence.html#persistence-extensions-in-scripts-and-rules), transformations, scripts.