Target Global Swatches with Collection Items

Does anyone know if it would be possible with custom code to use the color fields in the CMS to control global swatches?

Use Case:

Say you wanted to make a template for a client, and you dont want them in the designer, only the editor. It would be nice to somehow link your global swatches to the CMS so that they can change the colors of their site kind of like a Shopify template.

I dont want to have to drag a collection list into every element I build and reference colors from the CMS, I tried this, but then nesting other dynamic lists got messy and it looks like webflow only lets you nest two collection list.

So my idea if possible was to have javascript in the head of the site, which basically links the color fields you create in the CMS to the global swatches in your product.

Then the client just has to change the colors in the CMS to customize the colors.

I dont know how to write javascript, and I dont know the limitations of what Webflow allows you to do with custom code. Or maybe there is even an easier way that doesnt involve custom code?