I want to extract the Domain values of 380 and 750 from the following ColorDataFunction:

enter image description here

I'm missing something on the language-level—they don't seem to be Attributes, neither do they seem to be Properties (or I'm just using PropertyValue wrong)—what is it that I'm looking at in the grey box and how do I extract values from it?

  • 1
    $\begingroup$ Look at the parts; which then leads to ColorData["VisibleSpectrum"][[3]] $\endgroup$
    – Bob Hanlon
    Apr 22 at 0:52
  • $\begingroup$ @BobHanlon - Hm, how can parts be associated with "keys" like "Name" and "Gradient" though? (Not denying that it works—just wondering if that it works but there's more to the state behind the scenes.) I can agree with the 2 close votes so far that I am missing some fundamental knowledge; I'd disagree it's easily found in documentation. What is the name of this pattern that shows up as such in a grey box of key-value pairs? $\endgroup$ Apr 22 at 11:32
  • $\begingroup$ Look at the output of ColorData["VisibleSpectrum"] // InputForm, which is ColorDataFunction["VisibleSpectrum", "Physical", {380, 750}, Blend["VisibleSpectrum", #1] & ]. $\endgroup$
    – bbgodfrey
    Apr 22 at 14:22
  • $\begingroup$ Regarding the "easily found in documentation": It's the 7th bullet point in ColorData. $\endgroup$
    – Domen
    Apr 22 at 17:32
  • $\begingroup$ @Domen - Ah I did miss that. But what I was looking for in documentation that I couldn't find was more general—what this grey box was and how key-value pairs could be associated with a function. I found documentation about Attributes and Properties but they did not seem relevant and I didn't know what else to call these things. Maybe I have a more fundamental misunderstanding. $\endgroup$ Apr 22 at 21:05

1 Answer 1


Some things you can do

Get range

ColorData["VisibleSpectrum", "Range"]

{380, 750}

Extract all elements

Table[ColorData["VisibleSpectrum", i], {i, 380, 750}]

enter image description here

Extract single element (magnified)

ColorData["VisibleSpectrum", 550]

enter image description here

Get its RGB value

ColorData["VisibleSpectrum", 550] // InputForm


Get image

ColorData["VisibleSpectrum", "Image"]

enter image description here


Gradient color schemes don't accept ColorRules or ColorList properties

ColorData["VisibleSpectrum", "ColorRules"]


But we can mimic ColorRules as follows:

With[{cr = ColorData["VisibleSpectrum", "Range"]},
  Thread[Range @@ cr -> 
    Table[ColorData["VisibleSpectrum", i], 
      Evaluate[{i, Splice @ cr}]]]][[;; ;; 5]]

enter image description here

For other color schemes (which run from 0 to 1):

With[{cr = Range[100]},
 Thread[cr -> Table[ColorData["Rainbow", i], Evaluate[{i, cr/100}]]]]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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