Skip to content

Commit

Permalink
Fix for liveCode RBG triplet
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stam66 authored Mar 6, 2022
1 parent 6527fbb commit 9135359
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion TinyColor.livecodescript
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,18 @@ function inputToRGB pColor
put true into tResult["ok"]
end if

// Input is liveCode RGB
if the first char of pColor is a number and the number of items in pColor is 3 then
put replaceText(pColor, space, empty) into rgb
replace space with empty in pColor
split rgb by comma
put rgb[1] into tResult["r"]
put rgb[2] into tResult["g"]
put rgb[3] into tResult["b"]
put "rgb" into tResult["format"]
put true into tResult["ok"]
end if

if tResult["format"]is empty and typeof(pColor) is "string" then put stringInputToObject(pColor) into pColor

if typeof(pColor) is "object" then
Expand Down Expand Up @@ -1465,4 +1477,4 @@ private function _rightShift pNum, pOff
end if
end _rightShift

### END Utilities ###
### END Utilities ###

0 comments on commit 9135359

Please sign in to comment.