Skip to content

Commit 9135359

Browse files
authored
Fix for liveCode RBG triplet
inputToRGB required RGB inputs as RGB r b g or RBG(r, b, g) for RGB input, whereas livecode uses RBG in the format "r,g,b" - therefore while colorNames and hex formatted colours work, liveCode RGB inputs would fail. Additional entry made in inputToRGB to address this.
1 parent 6527fbb commit 9135359

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

TinyColor.livecodescript

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,18 @@ function inputToRGB pColor
429429
put true into tResult["ok"]
430430
end if
431431

432+
// Input is liveCode RGB
433+
if the first char of pColor is a number and the number of items in pColor is 3 then
434+
put replaceText(pColor, space, empty) into rgb
435+
replace space with empty in pColor
436+
split rgb by comma
437+
put rgb[1] into tResult["r"]
438+
put rgb[2] into tResult["g"]
439+
put rgb[3] into tResult["b"]
440+
put "rgb" into tResult["format"]
441+
put true into tResult["ok"]
442+
end if
443+
432444
if tResult["format"]is empty and typeof(pColor) is "string" then put stringInputToObject(pColor) into pColor
433445

434446
if typeof(pColor) is "object" then
@@ -1465,4 +1477,4 @@ private function _rightShift pNum, pOff
14651477
end if
14661478
end _rightShift
14671479

1468-
### END Utilities ###
1480+
### END Utilities ###

0 commit comments

Comments
 (0)