どの is classified as a ‘pre-noun adjectival’ in Japanese. These are a special type of word that do not conjugate, which means that they will always appear in the same form.
どの comes from the same family of words as
どれ and
どこ, and is used for asking about ‘which’ thing someone will choose.
In these examples, we can see that
どの may be used to ask a question, or it may also be used in a similar way to ‘whatever’, or ‘whichever’ in English.
どの is only used when there are 3 or more possible choices, and
どっち(
の)・
どちら(
の) will be used when there are only 2 possible choices.
In the first example, the speaker is asking specifically about 2 options ‘red or blue’, so
どっち will be used. However, in the second example, since the answer could be any color,
どの will be used instead.