Depending on what you’re looping over or where it comes from, you could always pass an attribute to assign styling. Take the most common example of looping though a cpt. If you add a custom field to that cpt, you can output that in the section your repeating and then set up styles based on that.
The field could be a radio group for various layout or spacing options or whatever. Seems the most painless way to me anyway
Something similar to this just with an acf field instead: How to set a background color based on post category - #2 by manc