extract color to color.go, and a little bug fix