Design of a versatile chemical assembly method for patterning colloidal nanoparticles