Laser cooling and trapping of potassium at magic wavelengths