Skip to content

Files

Latest commit

 

History

History
17 lines (14 loc) · 730 Bytes

28.md

File metadata and controls

17 lines (14 loc) · 730 Bytes
title date submitter tags discussion
I want to be able to pull a list of all custom properties on an element.
2019-08-02 14:37:55 UTC
Jonathan
css
javascript

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.