Red litmus contains a weak diprotic acid. When it is exposed to a basic compound, the hydrogen ions react with the added base. The conjugate base, formed from the litmus acid, has a blue color, so the wet red litmus paper turns blue in alkaline solution.
you dont have to study the mechanism of this.