Documentation
Color
Parameter
Information about the visual properties and meanings of the parameters can be found in the Object Presentation.
| Name | Type | Parameter | Description |
|---|---|---|---|
| PRESENTATION | String | The ID of the presentation | VARIABLE_PRESENTATION_COLOR {05CC3CC2-A0B2-5837-A4A7-A07EA0B9DDFB} |
| ENCODING | Integer | Encoding | 0: RGB, 1: CMYK, 2: HSV, 3: HSL |
| PRESET_VALUES | String | Default Values | JSON-encoded list of objects, the exact parameters are described under Colors Not available for encoding xy |
| COLOR_SPACE | Integer | Color Space | 0: Custom, 1: sRGB, 2: AdobeRGB, 3: DCI-P3, 4: Rec2020 |
| CUSTOM_COLOR_SPACE | String | Custom color space | JSON-encoded list of objects, the exact parameters are described under Custom Color Space |
| COLOR_CURVE | Integer | Color Curve | 0: None, 1: Custom, 2: Daylight, 3: Daylight (Spring), 4: Daylight (Summer), 5. Daylight (winter) |
| CUSTOM_COLOR_CURVE | String | Custom Color Curve | JSON-encoded list of objects, the exact parameters are described under Custom Color Curve |
Colors
| Parameter | Type | Description |
|---|---|---|
| Color | Integer | Color as Integer |
Custom Color Space
A color space is described by 4 objects with the following parameters. The 1st entry is for red, the 2nd for green, the 3rd for blue and the 4th for the white point.
| Parameter | Type | Description |
|---|---|---|
| x | Float | X position of the color on the CIE standard color chart in the range 0-1 |
| y | Float | Y position of the color on the CIE standard color chart in the range 0-1 |
Example:
// sRGB
[
{"x":0. 64, "y":0.33},
{"x":0.3, "y":0.6},
{"x":0.15, "y":0.06},
{"x":0.3127, "y":0.329}
]
Custom Color Curve
A color curve consists of any number of colors that represent the color temperature over the course of a day.
| Parameter | Type | Description |
|---|---|---|
| x | Float | X position of the color on the CIE standard color chart in the range 0-1 |
| y | Float | Y position of the color on the CIE standard color chart in the range 0-1 |
Example:
// Daylight (Winter)
[
{"x": 0. 477, "y" 0.4137},
{"x": 0.4599, "y" 0.4106},
{"x": 0.433, "y" 0.4027},
{"x": 0.4103, "y" 0.3932},
{"x": 0.3918, "y" 0.3835},
{"x": 0.3761, "y" 0. 374},
{"x": 0.3631, "y" 0.3652},
{"x": 0.352, "y" 0.357},
{"x": 0.3439, "y" 0.3507},
{"x": 0.3367, "y" 0.3447},
{"x": 0.3348, "y" 0.343},
]
Templates
// Registers a variable with shades of green as its default values.
$this->RegisterVariableString('Color', 'Color', [
'PRESENTATION' => VARIABLE_PRESENTATION_COLOR,
'TEMPLATE' => VARIABLE_TEMPLATE_COLOR_FOREST,
]);
| Name | Konstante | GUID |
|---|---|---|
| Rainbow | VARIABLE_TEMPLATE_COLOR_RAINBOW | {0C711895-2F8E-DBFE-1700-84173491D229} |
| Forest | VARIABLE_TEMPLATE_COLOR_FOREST | {A7467E68-5C39-5BD9-C0C8-BCE6004FEEAA} |
Beispiele
// When registering a variable for PHP modules
// Allows color selection in RGB format, with red, green, and blue as the default values.
$this->RegisterVariableString('ColorRGB', 'Color', [
'PRESENTATION' => VARIABLE_PRESENTATION_COLOR,
'ENCODING' => 0 /* RGB */,
'PRESET_VALUES' => json_encode([['Color' => 16711680], ['Color' => 65280], ['Color' => 255]]),
]);
// Allows color selection in the xy format within a custom color space
$this->RegisterVariableString('ColorXY', 'Color', [
'PRESENTATION' => VARIABLE_PRESENTATION_COLOR,
'ENCODING' => 4 /* xy*/,
'COLOR_SPACE' => 0 /* Custom */,
'SELECTION' => 1 /* CIE Diagram */,
'CUSTOM_COLOR_SPACE' => json_encode([
['x' => 0.692, 'y' => 0.308], // Red
['x' => 0.170, 'y' => 0.700], // Green
['x' => 0.153, 'y' => 0.048], // Blue
['x' => 0.3127,'y' => 0.329] // White point
])
]);
// For existing variables via script
// Allows color selection in RGB format, with red, green, and blue as the default values.
IPS_SetVariableCustomPresentation(12345, [
'PRESENTATION' => VARIABLE_PRESENTATION_COLOR,
'ENCODING' => 0 /* RGB */,
'PRESET_VALUES' => json_encode([['Color' => 16711680], ['Color' => 65280], ['Color' => 255]]),
]);
// Erlaubt die Farbauswahl im Format xy in einem eigenen Farbraum
IPS_SetVariableCustomPresentation(12345, [
'PRESENTATION' => VARIABLE_PRESENTATION_COLOR,
'ENCODING' => 4 /* xy*/,
'COLOR_SPACE' => 0 /* Benutzerdefiniert */,
'SELECTION' => 1 /* CIE Diagramm */,
'CUSTOM_COLOR_SPACE' => json_encode([
['x' => 0.692, 'y' => 0.308], // Red
['x' => 0.170, 'y' => 0.700], // Green
['x' => 0.153, 'y' => 0.048], // Blue
['x' => 0.3127,'y' => 0.329] // White point
])
]);