Search⌘ K

Programmatic Access

Explore how to obtain and use CSS theme values programmatically through JavaScript. Learn to extract theme names directly from CSS variables, enabling dynamic app theming with a single source of truth and eliminating redundancy in design management.

We'll cover the following...

What is programmatic access? #

As developers who use web technologies, we’re used to working across three different but cooperative languages: HTML (the layout), JS (the script), CSS (the style).

Sometimes, it’s beneficial to be able to access what we define in CSS from the script. This is what we mean by gaining programmatic access to the values we define in our CSS/SCSS.

Let’s look at a use case. Assuming we have 3 different themes in our app, we’ll have those defined somewhere in our CSS/SCSS files. ...