I'm exploring QGIS python functions to set all raster layers with a custom transparency, i.e 0,0,0,100 .

Looking at some previous questions. There is a way to loop all the layers, but the aspect to set transparency value on RGB values, I've been having difficulties understanding the documentation. 

http://gis.stackexchange.com/questions/88908/how-to-set-the-transparency-for-multiple-layers-or-add-a-global-transparancy-pre

    for layer in iface.legendInterface().layers():
       layer.renderer().setOpacity(0.2)

https://gis.stackexchange.com/questions/77391/how-do-i-set-layer-transparency-in-qgis-2-0-with-python
The example here uses TransparentSingleValuePixel but i notice there is a TransparentThreevaluePixel 

    x = QgsRasterTransparency.TransparentSingleValuePixel()
    x.pixelValue = 123
    x.transparencyPercent = 50
    rt.setTransparentSingleValuePixelList( [ x ] )