Let's begin with "Why a substance is not transparent?
A substance may be not transparent because it reflects the incoming light or because it absorbs the incoming light. Of course, almost all substances reflect a part and absorb a part of the incoming light.
Metals reflect most of the light because they have free electrons. These electrons are shaken by the electric field of the the light which is an electromagnetic wave. Shaken electrons emit two waves. One in the direction of the incoming wave that is seen as the reflected wave and one similar in the same direction as the incoming wave which, added with it, give a zero amplitude wave.
Dielectrics do not have free electrons. So the electrons bound to atoms are less shaken and reflect just a fraction of the incident wave. As the amplitude of the generated wave is less, there is a wave that enters the dielectric. We are talking about a transparent dielectric, as glass.
If you put colorant (dye) molecules in the dielectric, they will absorb the power of the entering wave. This power is transformed in potential energy that can transform in heat or even in other kind of light in some substances. The electrons in the dye absorb energy by climbing to higher energy states in the molecule.
A dielectric (even a black one) always reflects a part of the incoming light. If it doesn't contain light absorbent molecules (pigments, dyes, colorants), it is transparent.