I've loaded a CSV:
Colors = Import[
"d:\\bitbucket\\diversity\\data\\nlcd\\nlcd-colors.csv", "CSV"]
{{0., " 0.00000000000 0.00000000000 0.00000000000"}, {11.,
" 0.27843137255 0.41960784314 0.62745098039"}, {12.,
" 0.81960784314 0.86666666667 0.97647058824"}, {21.,
" 0.86666666667 0.78823529412 0.78823529412"}, {22.,
" 0.84705882353 0.57647058824 0.50980392157"}}
And I would like this:
{{0., RGBColor[0.00000000000,0.00000000000,0.00000000000]}, {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]}}
Flatten[{First[#], RGBColor @@@ ToExpression[StringSplit[Rest[#]]]}] & /@ Colors
$\endgroup$MapAt
:MapAt[RGBColor @@ ToExpression[StringSplit[#]] &, Colors, {All, 2}]
$\endgroup$