What is the use of 色 in color names? I thought that the proper way to use the basic color names is generally with 色, i.e.:

这件衣服是蓝色的

But recently I have come across such a sentence:

我不喜欢黄的，我喜欢白的。

Is the 色 optional, or is the difference in use making 色 disappear in the second example?
If you learn the context, you will notice it is more complicated than the probable duplicate answer links. 


  Context 1 : 我不喜欢黄（色）的，我喜欢白（色）的。 


This shows a preference for particular stuff with attributes other than the color, color is used to highlight the choice, and that is why 的is used. E.g. there are white and yellow candies in different flavors. Instead of specifying the flavor, one may use their color to indicate the choices.


  Context 2 : 我不喜欢黄色，我喜欢白色。


This shows explicit preference in color. E.g. there are two pairs of pants that look exactly the same, and the person likes the white color. 

Though in daily life, both can be used interchangeably in an ambiguous way. However, for a writer, this will give explicit characteristic to the character in their writing.