Visual overrides

Almost every theme has options which cannot be implemented with a simple CSS class addition, such as color options which allow the user to select the color from color picker.

As using the style attribute is not an elegant solution, we have created an alternative which allows you to create custom CSS code on the fly during the website rendering process.

To do so, create a visual-override.js file in your theme directory and create a function which will be used to generate additional CSS code based on the options params:

/*
 * Custom function used to generate the output of the override.css file
 */

var generateOverride = function(params) {
    return `
        body {
            background: ${params.primaryColor};
            font-size: ${params.fontSize}px;
        }
    `;
};

module.exports = generateOverride;

Your function must use one argument - params. It contains an object with all your custom theme options values.

The function must return CSS code which will be linked with the main CSS file from the theme.

We recommend using JavaScript multi-line strings for better code readability.