Made preview function work with `data-theme` config.