fix export colors

this PR fixes #302. i also did some refactoring.