(function($) {
    function resetColorsToDefault() {
        // Define default values for your color settings
        const defaultColors = {
            'background_color': '#ffffff',
            'recycling_energy_primary_color': '#7fb93d',
            'recycling_energy_heading_color': '#1d2b09',
            'recycling_energy_text_color': '#555555',
            'recycling_energy_primary_fade': '#f3ffe5',
            'recycling_energy_footer_bg' :'#1d2b09',
            'recycling_energy_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);