You may have to think in French, and obsolete French, at that!
In French, the word 'bleu' (blue) was once used as a euphemism for 'dieu' (God).At one time a Frenchman who could have exclaimed, blasphemously, 'Mort Dieu!' [from 'death' and 'God', "God('s) death!"] would have preferred the politer 'Mort Bleu' [from 'Death' and 'Blue', 'blue' being the euphemism for God]. 'Mort bleu' became 'morbleu' in time. 'Sacre [with acute accent on the E] Dieu ' 'holy God!' became 'Sacre Bleu' and then 'sacrebleu'.French had others e.g there was one oath literally meaning 'blue guts! (which was in an old French dictionary I had once)
In English we use, or used, blue as an intensifier too: 'blue funk' or 'blue fear', 'blue blazes'.
It may be that we took 'bleu' and rendered it into English.Not so unlikely: our government and courts did speak French once before they went to a mixture of French and English and then English. There seems an interesting relationship between 'morbleu' and 'blue murder'. The original reference to God would have been unknown or forgotten.Can't currently find a 'meurtre bleu', literally 'blue murder' in my modern French dictionary, though, which isn't to say it didn't exist once.