So I wanted to manipulate through both the color schemes and the RGB color within that scheme but encountered a problem. I started by defining a function:

txt[input_] := InputForm[TextString[input]];

Such that I could preserve the quotation marks applied to input, needed for ColorData["input"]. Then a list of a few schemes was built:

list = txt /@ {Rainbow, DarkRainbow, Pastel}


{InputForm["Rainbow"], InputForm["DarkRainbow"], InputForm["Pastel"]}

Which then allows for list[[x]], so that manipulating {x,1,Length[list],1} cycles through the scheme in ColorData:

Manipulate[ColorData[list[[y]]][x], {y, 1, Length[list], 1}, {x, 0, 1}]

Which doesn't output correctly. Taking the part of the list seems to work fine, but the InputForm["Rainbow"] inserted into ColorData[InputForm["Rainbow"]] seems to be kicking up errors. I've tried a lot of different things but can't get it working. Any help would be much appreciated!

  • 1
    $\begingroup$ Why not have list as a list of strings; list = {"Rainbow", "DarkRainbow", "Pastel"}. Or even better just let Manipulate have y be the list of strings; Manipulate[ColorData[y][x], {y, list}, {x, 0, 1}]. $\endgroup$
    – Edmund
    Jun 10, 2017 at 16:07
  • $\begingroup$ You might want to compare the outputs of Head[InputForm["DarkRainbow"]] and Head["DarkRainbow"]. ColorData yields a ColorDataFunction when an argument has a head String and is the name of a known color scheme. $\endgroup$
    – Michael E2
    Jun 10, 2017 at 16:11

1 Answer 1


As Edmund commented:

list = {"Rainbow", "DarkRainbow", "Pastel"};

Manipulate[ColorData[y, x], {y, list}, {x, 0, 1}]

InputForm is a formatting wrapper, i.e. for display to you, not for passing between functions. (In most cases.) You may have wanted ToString or SymbolName but it is better to simply keep a list of Strings.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.