Condensation of resorcinol with benzaldehyde in the presence of an acid gives an oligomeric product having a quinonic end group. The presence of the quinonic end group acts as a chromophore, and provides distinct visible absorptions at 450 and 475 nm. The oligomer interacts with different amines in a non-stoichiometric manner to give new absorptions at 525 nm. On addition of mineral acid, a new state can be generated having absorbance at 455 nm. This absorption can also be obtained from the interaction of an ammonium salt with the oligomer. The absorptions at 455 nm due to interaction with ammonium cation can be pushed back and forth to 525 nm by adding amine and acid, respectively showing the property of chemically driven reversible optical switching.