Magnetically tunable self-assembly of colloidal rings