diff --git a/wled00/json.cpp b/wled00/json.cpp index d2b771c590..40e7b4f645 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -205,7 +205,7 @@ static bool deserializeSegment(JsonObject elem, byte it, byte presetId = 0) // JSON "col" array can contain the following values for each of segment's colors (primary, background, custom): // "col":[int|string|object|array, int|string|object|array, int|string|object|array] // int = Kelvin temperature or 0 for black - // string = hex representation of [WW]RRGGBB + // string = hex representation of [WW]RRGGBB or "r" for random color // object = individual channel control {"r":0,"g":127,"b":255,"w":255}, each being optional (valid to send {}) // array = direct channel values [r,g,b,w] (w element being optional) int rgbw[] = {0,0,0,0}; @@ -229,6 +229,9 @@ static bool deserializeSegment(JsonObject elem, byte it, byte presetId = 0) if (kelvin == 0) seg.setColor(i, 0); if (kelvin > 0) colorKtoRGB(kelvin, brgbw); colValid = true; + } else if (hexCol[0] == 'r' && hexCol[1] == '\0') { // Random colors via JSON API in Segment object like col=["r","r","r"] ยท Issue #4996 + setRandomColor(brgbw); + colValid = true; } else { //HEX string, e.g. "FFAA00" colValid = colorFromHexString(brgbw, hexCol); }