The relationship is complex, but a simple model can be used to show many essential features. The model shows that electrons restricted to a box the size of a covalent bond absorb in the ultraviolet, and so are colorless. This explains why many organic materials that have color have structures with electrons that aren't pinned down in single covalent bonds. See Why things have color from Carnegie-Mellon for a Java applet that illustrates how electron confinement affects the color of a material. Confining electrons to a smaller space makes the light they absorb bluer.
More confinement makes the light absorbed bluer, and less makes it redder.
When a hydrogen ion combines with the base form of an indicator molecule, it will confine two formerly mobile electrons to a single covalent bond with the hydrogen, shifting the light that is absorbed towards the blue end of the spectrum. Indicator structures often undergo additional changes that amplify the change in electron confinement. The color of a transparent object is due to the colors of light that can pass through the material. For example, white light passing through a glass of red wine looks red because the wine has absorbed the other colors, and lets only the red light pass through. To see this, try looking through a piece of red cellophane at objects of different colors.