<?php if(!function_exists('solarva_configs')){
    function solarva_configs($value){
        $primary_darker = solarva()->get_opt('primary_color', '#5f2dde');
        $primary_darker_10 = pxl_darker_color($primary_darker, $primary_darker_10=1);
        $primary_darker_20 = pxl_darker_color($primary_darker, $primary_darker_20=1.3);
        $primary_darker_30 = pxl_darker_color($primary_darker, $primary_darker_30=3);
        $primary_darker_40 = pxl_darker_color($primary_darker, $primary_darker_40=4);

        $configs = [
            'theme_colors' => [
                'primary'   => [
                    'title' => esc_html__('Primary', 'solarva'), 
                    'value' => solarva()->get_opt('primary_color', '#4AAB3D')
                ],
                'gradient-first'   => [
                    'title' => esc_html__('Gradient First', 'solarva'), 
                    'value' => solarva()->get_opt('gradient_first_color', '#ffa800')
                ],
                'secondary'   => [
                    'title' => esc_html__('Secondary', 'solarva'), 
                    'value' => solarva()->get_opt('secondary_color', '#072032')
                ],
                'third'   => [
                    'title' => esc_html__('Third', 'solarva'), 
                    'value' => solarva()->get_opt('third_color', '#00c5fe')
                ],
                'dark'   => [
                    'title' => esc_html__('Dark', 'solarva'), 
                    'value' => solarva()->get_opt('dark_color', '#000')
                ],
                'body-bg'   => [
                    'title' => esc_html__('Body Background Color', 'solarva'), 
                    'value' => solarva()->get_page_opt('body_bg_color', '#fff')
                ],
            ],
            'link' => [
                'color' => solarva()->get_opt('link_color', ['regular' => '#072032'])['regular'],
                'color-hover'   => solarva()->get_opt('link_color', ['hover' => '#4AAB3D'])['hover'],
                'color-active'  => solarva()->get_opt('link_color', ['active' => '#4AAB3D'])['active'],
            ],
            'gradient' => [
                'color-from' => solarva()->get_opt('gradient_color', ['from' => '#FFCD28'])['from'],
                'color-to' => solarva()->get_opt('gradient_color', ['to' => '#27B671'])['to'],
            ],
            'gradient2' => [
                'color-from' => solarva()->get_opt('gradient_color2', ['from' => '#8c92f6'])['from'],
                'color-to' => solarva()->get_opt('gradient_color2', ['to' => '#f9d78f'])['to'],
            ],
               
        ];
        return $configs[$value];
    }
}
if(!function_exists('solarva_inline_styles')) {
    function solarva_inline_styles() {  
        
        $theme_colors      = solarva_configs('theme_colors');
        $link_color        = solarva_configs('link');
        $gradient_color    = solarva_configs('gradient');
        $gradient_color2   = solarva_configs('gradient2');

        ob_start();
        echo ':root{';
            
            foreach ($theme_colors as $color => $value) {
                printf('--%1$s-color: %2$s;', str_replace('#', '',$color),  $value['value']);
            }
            foreach ($theme_colors as $color => $value) {
                printf('--%1$s-color-rgb: %2$s;', str_replace('#', '',$color),  solarva_hex_rgb($value['value']));
            }
            foreach ($link_color as $color => $value) {
                printf('--link-%1$s: %2$s;', $color, $value);
            }
            foreach ($gradient_color as $color => $value) {
                printf('--gradient-%1$s: %2$s;', $color, $value);
            }
            foreach ($gradient_color2 as $color => $value) {
                printf('--gradient-%1$s2: %2$s;', $color, $value);
            }

        echo '}';

        return ob_get_clean();
         
    }
}
 