Dry ammonia does not liberate any ions like $$OH^-$$ as it is not in contact with water, thereby has no action on litmus paper. Ammonia solution in water turns red litmus blue as it forms ammonium ion ($$NH_4^+$$) and hydroxyl ion ($$OH^-$$). $$NH_3 +H_2O \rightarrow NH_4^+ +OH^-$$ Here ammonia act as a base by liberating $$OH^-$$ ion. Thus it turns red litmus paper blue. Acidic and basic nature of a substance is because of the formation of $$H^+$$ ions in solution and $$OH^–$$ ions in solution, respectively.