You could also try
MapAt[
Apply[RGBColor,First@ImportString[#, "Table"]] &, Colors, {All, 2}]
which outputs
{ {0., RGBColor[{0., 0., 0.}]}, {11.,RGBColor[{0.27843137255, 0.41960784314, 0.62745098039}]}, {12., RGBColor[{0.81960784314, 0.86666666667, 0.97647058824}]}, {21., RGBColor[{0.86666666667, 0.78823529412, 0.78823529412}]}, {22., RGBColor[{0.84705882353, 0.57647058824, 0.50980392157}]} }
or, equivalently
Effectively, MapAt
applies an appropriate data extracting function on the second item for every entry in the list Colors
.
The function that it uses to extract the data (in this case, the RGB values in the strings) is Apply[RGBColor,First@ImportString[#, "Table"]] &
.
Every string sequence of RGB values is first parsed, using ImportString
; this produces a list of values (not a string, anymore).
Each list of values is then, in turn, transformed to an RGBColor
by replacing their head of List
with the appropriate RGBColor
head (this is what the Apply[RGBColor,<>]
portion of the code does).