Echoing CSS vars

Sometimes you want to echo out the value of css variables but they are hard to debug unless you know where to look.

In JavaScript just do the following:

getComputedStyle(document.documentElement).getPropertyValue('--my-cool-var')

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.