broke out color and alpha handling to a master class for layers