factored out brightness() method
reorganized functions and types in palettize.go