<?php
/**
 * CSS vars logic - Preloader
 *
 * @package Multi
 */

if ( ! defined( 'ABSPATH' ) ) {
	die;
}

/**
 * Prepares css variables holding preloader properties
 */
function multimagazine_css_vars_preloader() {
	$css = '';
	if ( get_theme_mod( 'multi_preloader', MULTIMAGAZINE_PRELOADER ) ) {
		$preloader_bg_color = get_theme_mod( 'multi_preloader_bg_color', MULTIMAGAZINE_PRELOADER_BG_COLOR );
		$preloader_bg_color = empty( $preloader_bg_color ) ? MULTIMAGAZINE_PRELOADER_BG_COLOR : $preloader_bg_color;

		$css .= '--preloader-background-color: ' . $preloader_bg_color . ";\n";

		$preloader_spinner_color = get_theme_mod( 'multi_preloader_spinner_color', MULTIMAGAZINE_PRELOADER_SPINNER_COLOR );
		$preloader_spinner_color = empty( $preloader_spinner_color ) ? MULTIMAGAZINE_PRELOADER_SPINNER_COLOR : $preloader_spinner_color;

		$css .= '--preloader-spinner-color: ' . $preloader_spinner_color . ";\n";
	}
	return $css;
}
