Fix bug where color variable went out of scope