Beyond its taste, set designer Roger Christian shared in a retrospective for StarWars.com that the blue milk actually posed a major logistical issue on the set of the film.
Christian had the role of preventing actors from getting sick while drinking warm milk on the hot North African sets and reaching the right shade of blue required for the scene.
Christian recalled, “I had a lot of time agonizing over blue milk because there wasn't much that I could find. [...] milk would be difficult to get, and also it would be hot.”
He shared the solution he discovered in Tunisia, stating, “I eventually found what's called cochineal. It was a food coloring that was more like the [food coloring] for blueberry.”
Christian used long-life milk that doesn't require refrigeration but is known for its “burnt” taste, which explains Hamill's distaste for the blue milk.