I’m excited to introduce Variable Modes and Groups for Divi 5! 🎉
Variable Modes let you define multiple values for the same variable and choose which mode to use on an element and its children. Variable Groups let you organize your variables by purpose and find them in the builder as you work.
For example, give your background and text color variables light and dark palettes. Apply Dark Mode to your hero section, and the headings and buttons inside can inherit the dark palette while the rest of the page uses Light Mode.
You don’t need to create different presets or versions of the same element; change its mode, and the variables update accordingly!
Let’s take a look. 👇
Give One Variable More Than One Value
Variables give reusable values a name. A variable called Surface might hold the background color for your cards, and Card Padding might control the space inside them. Variable Modes let you give the same variable different values in different parts of your site.
For example, one color variable might have different values for light and dark mode sections.
To create a variable mode, open Variables from the Visual Builder sidebar, expand Colors, and click Add Color Variable Mode. Divi puts your existing colors in the first column and adds a column for the new mode. Name it “Dark Mode,” then enter alternative values for colors such as Surface, Heading Text, and Link. Any value you leave inherited follows the default mode. Click Save Variables when you’re ready.
When you apply Dark Mode to an element or its parent container, the element’s or container’s dark mode values are used—one variable, two values.
You can create modes for colors, fonts, gradient variables, images, links, numbers, and text. Each type has its own modes so that a section can use Dark Mode for colors, Dense for spacing, and the site’s default fonts.



0 Comments