I want to be able to pull a list of all custom properties on an element.

Submitted by Jonathan

Right now, if I want to get the value of a CSS custom property set on an element, I can do something like:

getComputedStyle(element).getPropertyValue("--my-custom-property")

It's fine if you already know the name of the variable, but what if you want a list of custom properties and their values? I'm currently building a style guide where I have different themes and it would be awesome to select an element and get an object containing key/value pairs for all CSS variables.

Tagged
CSS JavaScript