Color spectrum and rainbow formation