<?php
/**
 * Adds the Colors section and its fields to the General Settings panel.
 * 
 * Allows users to configure color settings for various theme elements.
 *
 * @package Yaatra
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

add_action( 'customize_register', 'yaatra_register_theme_colors_options' );

if ( ! function_exists( 'yaatra_register_theme_colors_options' ) ) :

	/**
	 * Registers theme options for the Colors section in the Customizer.
	 * 
	 * Adds and configures settings related to colors within the WordPress Customizer.
	 *
	 * @param WP_Customize_Manager $wp_customize The Customizer object for managing theme options.
	 * @since 1.1.0
	 */
    function yaatra_register_theme_colors_options( $wp_customize ) {

    	/**
         * Color Picker field for the Primary Color.
         * 
         * General Settings > Colors
         * 
         * @since 1.0.0
         */
        $wp_customize->add_setting( 'yaatra_theme_color',
            array(
                'default'           => yaatra_get_customizer_default ( 'yaatra_theme_color' ),
                'sanitize_callback' => 'sanitize_hex_color',
            )
        );
        $wp_customize->add_control( new WP_Customize_Color_Control(
            $wp_customize, 'yaatra_theme_color',
                array(
                    'priority'   => 5,
                    'section'    => 'colors',
                    'settings'   => 'yaatra_theme_color',
                    'label'      => __( 'Primary Theme Color', 'yaatra' )
                )
            )
        );

    }

endif;