<?php
global $moment_panels;
global $moment_sections;
global $moment_settings_controls;
global $moment_repeated_settings_controls;
global $moment_customizer_defaults;

/*creating panel for general*/
$moment_panels['moment-colors'] =
    array(
        'title'          => __( 'Color Settings', 'moment' ),
        'description'    => __( 'Customize colors of you awesome site', 'moment' ),
        'priority'       => 42,
    );
/*defaults values*/
$moment_customizer_defaults['moment-primary-color'] = '#2e5077';
$moment_customizer_defaults['moment-site-identity-color'] = '#fff';
$moment_customizer_defaults['moment-main-title-color'] = '#313131';
$moment_customizer_defaults['moment-main-sub-title-color'] = '#6d6d6d';
$moment_customizer_defaults['moment-menu-color'] = '#fff';
$moment_customizer_defaults['moment-link-color'] = '#2E5077';
$moment_customizer_defaults['moment-primary-hover-color'] = '#DFB200';

$moment_customizer_defaults['moment-bg-breadcrumb-color'] = '#1D3A5B';
$moment_customizer_defaults['moment-bg-letest-post-color'] = '#f1f1f1';
$moment_customizer_defaults['moment-bg-footer-color'] = '#636B6B';

$moment_customizer_defaults['moment-color-reset'] = '';


/**
 * Reset color settings to default
 * @param  $input
 *
 * @since Moment 1.0
 */
if ( ! function_exists( 'moment_color_reset' ) ) :
    function moment_color_reset( $input ) {
        if ( $input == 1 ) {
            global $moment_customizer_defaults;

            /*getting fields*/
            $moment_customizer_saved_values = moment_get_all_options();

            /*setting fields */
            $moment_customizer_saved_values['moment-primary-color'] = $moment_customizer_defaults['moment-primary-color'];
            $moment_customizer_saved_values['moment-site-identity-color'] = $moment_customizer_defaults['moment-site-identity-color'];
            $moment_customizer_saved_values['moment-main-title-color'] = $moment_customizer_defaults['moment-main-title-color'];
            $moment_customizer_saved_values['moment-main-sub-title-color'] = $moment_customizer_defaults['moment-main-sub-title-color'];
            $moment_customizer_saved_values['moment-menu-color'] =$moment_customizer_defaults['moment-menu-color'];
            $moment_customizer_saved_values['moment-link-color'] = $moment_customizer_defaults['moment-link-color'];
            $moment_customizer_saved_values['moment-primary-hover-color'] = $moment_customizer_defaults['moment-primary-hover-color'];
            
            $moment_customizer_saved_values['moment-bg-breadcrumb-color'] = $moment_customizer_defaults['moment-bg-breadcrumb-color'];
            $moment_customizer_saved_values['moment-bg-letest-post-color'] = $moment_customizer_defaults['moment-bg-letest-post-color'];
            $moment_customizer_saved_values['moment-bg-footer-color'] = $moment_customizer_defaults['moment-bg-footer-color'];
            remove_theme_mod( 'background_color' );
            $moment_customizer_defaults['moment-color-reset'] = '';

            /*resetting fields*/
            moment_reset_options( $moment_customizer_saved_values );
        }
        else {
            return '';
        }
    }
endif;

$moment_settings_controls['moment-site-identity-color'] =
    array(
        'setting' =>     array(
            'default'              => $moment_customizer_defaults['moment-site-identity-color'],
        ),
        'control' => array(
            'label'                 =>  __( 'Site Identity Color', 'moment' ),
            'description'           =>  __( 'Site title and tagline color', 'moment' ),
            'section'               => 'colors',
            'type'                  => 'color',
            'priority'              => 10,
            'active_callback'       => ''
        )
    );
