(function($) {
    function resetColorsToDefault() {
        // Define default values for your color settings
        const defaultColors = {
            'background_color': '#ffffff',
            'agriculture_farming_primary_color': '#8ec63f',
            'agriculture_farming_top_bg_color': '#181a1e',
            'agriculture_farming_heading_color': '#181a1e',
            'organic_farm_text_color' :'#707070',
            'agriculture_farming_primary_fade': '#effbdd',
            'organic_farm_post_bg': '#ffffff',
            'agriculture_farming_footer_bg': '#131313',
        };

        // 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);