<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

if ( ! function_exists( 'nevo_customizer_color_config' ) ) {
	function nevo_customizer_color_config( $configs ) {

		$section = 'global_color';

		$config = array(

			array(
				'name'     => "{$section}",
				'type'     => 'section',
				'panel'    => 'general_panel',
				'title'    => __( 'Global Colors', 'nevo' ),
				'priority' => 10,
			),
			array(
				'name'    => $section . '_h_main',
				'type'    => 'heading',
				'section' => $section,
				'title'   => __( 'Main Color', 'nevo' ),
			),
			/* 
			array(
				'name'            => 'colors_colors',
				'type'            => 'radio_group',
				'section'         => $section,
				'title'           => __( 'Color', 'nevo' ),
				'selector'        => '.entry-summary',
				'css_format'      => 'color:var(--nvt-{{value}});',
				'default'         => 'primary',
				'choices'         => array(
					'primary'	 => __( 'Primary', 'nevo' ),
					'secondary'  => __( 'Secondary', 'nevo' ),
					'success'	 => __( 'Success', 'nevo' ),
					'info'		 => __( 'Info', 'nevo' ),
					'warning'	 => __( 'Warning', 'nevo' ),
					'link'		 => __( 'Link', 'nevo' ),
					'link-hover' => __( 'Link Hover', 'nevo' ),
					'base'		 => __( 'Base', 'nevo' ),
					'title'		 => __( 'Title', 'nevo' ),
					'meta'		 => __( 'Meta', 'nevo' ),
					'heading'	 => __( 'Heading', 'nevo' ),
					'white'	 	 => __( 'White', 'nevo' ),
				),
				'priority' 		  => 5,
			),
			 */
			array(
				'name'       => $section . '_style',
				'type'       => 'styling',
				'section'    => $section,
				'title'      => __( 'Colors', 'nevo' ),
				'description' => __( 'Theme color applied.', 'nevo' ),
				'selector'   => array(
					'normal' => ':root',
				),
				'default'   => array(
					'normal' => array(
						'primary'	=> '#2487ce',
						'secondary' => '#999395',
						'success'	=> '#198754',
						'info'	=> '#0dcaf0',
						'warning'	=> '#da5555',
						'link'	=> '#0d6efd',
						'link_hover'	=> '#0a58ca',
						'base'	=> '#212529',
						'title'	=> '#222222',
						'meta'	=> '#4b4545',
						'heading'	=> '#222222',
					),
				),
				'css_format' => 'styling',
				'fields'     => array(
					'normal_fields' => array(
						'text_color'     => false,
						'link_color' 	 => false,
						'padding'        => false,
						'paddinga'       => false,
						'margin'         => false,
						'bg_heading' 	 => false,
						'bg_color' 		 => false,
						'bg_image' 		 => false,
						'bg_cover' 		 => false,
						'bg_position' 	 => false,
						'bg_repeat' 	 => false,
						'bg_attachment'  => false,
						'border_heading' => false,
						'border_width'   => false,
						'border_color'   => false,
						'border_radius'  => false,
						'box_shadow'     => false,
						'border_style'   => false,
					),
					'hover_fields'  => false,
				),
			),
			/* array(
				'name'    => $section . '_h_categories',
				'type'    => 'heading',
				'section' => $section,
				'priority' => 100,
				'title'   => __( 'Categories background Color', 'nevo' ),
			), */
		);
		// Category color options.
		/* $args           = array(
			'orderby'    => 'id',
			'hide_empty' => 0,
		);
		$categories     = get_categories( $args );
		$priority_count = 110;

		foreach ( $categories as $category_list ) {
			$category_classes = 'span.cat-links a.category-' . $category_list->slug;
			$config[] = array(
				'name'       => 'nevo_category_color_' . get_cat_id( $category_list->cat_name ),
				'type'       => 'color',
				'section'    => $section,
				'default'    => '',
				'title'      => $category_list->cat_name,
				//'selector'   => '.blog-cols',
				'selector'   => $category_classes,
				'css_format' => 'background-color: {{value}}',
				'priority' 	 => $priority_count,
				//'render_callback' => 'nevo_display_content',
			);

			$priority_count++;

		} */

		return array_merge( $configs, $config );
	}
}

add_filter( 'nevo/customizer/config', 'nevo_customizer_color_config', 199 );
