What does the orange keys mean in keyboard viewer?
Those keys in orange are so-called dead keys. It's a key that does not necessarily generate a complete character by itself but may modify the character generated by the key struck immediately after.

The usage of those dead keys in a text editor or in the Terminal is usually indicated by a yellowish background. You may then enter the main character you want to modify to finally get the desired one.

Not all combinations of a dead key and a normal key are used. Typing altn (=~) n will result in a 'ñ'. But altn (=~) t just gives '~t'.