It's worth separating the two examples as examples of different constructions to ask the same type of question. It will make more sense if you comprehend the following:
X が (adjective/verb) か。
(X as subject「が」) (adjective/verb question「か」)
(what color is the subject) (do you like is the question)
What color do you like?
As you mentioned before, なにいろ is a sort of question expression asking which color or what color or something to that effect.
This is related to, but not exactly the same as:
X は Y が (adjective/verb) か。
(X as topic「は」) (Y as subject「が」) (adjective/verb question「か」)
食べ物は なにが すきですか。
(food is the topic) (what is the subject) (do you like is the question)
As for food, what do you like?
That being said, it is possible to rewrite なにいろがすきですか as いろはなにがすきですか but it sounds more natural in the first form whenever it is available depending on the question. Likewise, it is possible to rewrite たべものはなにがすきですか to なんのたべものがすきですか。