(function($) {
    function resetColorsToDefault() {
        // Define default values for your color settings
        const defaultColors = {
            'background_color': '#ffffff',
            'fitmeal_dietitian_primary_color': '#efb443',
            'fitmeal_dietitian_secondary_color': '#6d8c54',
            'fitmeal_dietitian_heading_color': '#282b2d',
            'fitmeal_dietitian_product_bg': '#ebebeb',
            'nutrition_diet_text_color': '#949fa7',
            'fitmeal_dietitian_primary_fade': '#efdcb3',
            'fitmeal_dietitian_footer_bg' :'#282b2d',
            'nutrition_diet_post_bg': '#ffffff',
        };

        // Iterate over each setting and set it to its default value
        for (let settingId in defaultColors) {
            wp.customize(settingId).set(defaultColors[settingId]);
        }

        // Optionally refresh the preview
        wp.customize.previewer.refresh();
    }

    // Attach reset function to global scope
    window.resetColorsToDefault = resetColorsToDefault;

    $(document).ready(function() {
        $('.color-reset-btn').val('RESET'); // This adds the 'RESET' text inside the button
    });
})(jQuery);