This explanation is mostly above VCE level:
Indicators are weak acids that are coloured.

, where HB is the indicator in acid form, and B
- is the conjugate base form. These two forms are different colours. In acidic environments, the indicator (a weak acid) will not be able to ionise, hence will remain in the acidic form HB. In a basic environment, the indicator will neutralize with the base, and will be mostly present in the B- form.
From above, we can write the expression for equilibrium constant

taking -log
10 of both sides:
 = -\log_{10}\left( \frac{[H^+][B^-]}{[HB]} \right))
 = -\log_{10}([H^+]) + -\log_{10} \left( \frac{[B^-]}{[HB]}\right))
 = pH)
<-- This formula is widely used at uni level.
pKa is calculated by the same method pH is calculated (small Ka, high pKa, large Ka, small pKa)
It can be seen here that if pH is greater than pKa, the basic form predominates, and vice versa. At pKa, the concentration of base equal acid. The pH range is a range where neither basic nor acidic form of the indicator are dominant, and the colour is a mixture of both. Beyond the pH range, one form dominates, and the colour is distinct.