rescoping buildpalettefromdict

by making it a method of palette