<?php
//preloader custom setting
function anggita_preloader_set()
{

	$pr_color =  get_theme_mod('anggita_bg_preloader');
	$loader_bg = "
		#preloader{background-color: $pr_color;}";
	if ($pr_color != '') {
		wp_add_inline_style('anggita-styles', $loader_bg);
	}
}
//CSS ouput script
add_action('wp_enqueue_scripts', 'anggita_preloader_set', 11);

function anggita_preloader()
{
	if (get_theme_mod('anggita_preloader_show') == 'home' ||  get_theme_mod('anggita_preloader_show') == 'all') {
		wp_enqueue_script('preloader', plugin_dir_url(__FILE__) . 'js/loader.js', array('jquery'), '1.0.0', false);
	}
}

//CSS ouput script
add_action('wp_enqueue_scripts', 'anggita_preloader');