<?php
/***
 * Custom Color Options
 *
 * Get custom colors from theme options and enqueue CSS color settings
 *
 */
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}
// Display Custom Sytles
add_action( 'wp_enqueue_scripts', 'pmthemes_pre_made_styles', 10 );
function pmthemes_pre_made_styles() {
    $theme_options = pmthemes_theme_options();
    $styles = pmthemes_theme_style_keys();
    foreach ($styles as $style => $colors) {
        if ( isset($theme_options['theme_styles']) and $theme_options['theme_styles'] == $style ) {
            wp_enqueue_style('pmthemes-custom', PMTHEMES_URI . '/css/styles/'. $style .'.css',
                array(), PMTHEMES_VERSION);
            break;
        }
        if(empty($theme_options['theme_styles'])) {
            wp_enqueue_style( 'pmthemes-custom', PMTHEMES_URI . '/css/colors.css',
                array(), PMTHEMES_VERSION  );
        }
    }
}
// Add Custom Colors
add_action( 'wp_enqueue_scripts', 'pmthemes_custom_colors');
function pmthemes_custom_colors() {
    // Get Theme Options from Database
    $theme_options = pmthemes_theme_options();
    // Get Default Fonts from settings
    $theme_def = pmthemes_default_options();
    // Set Color CSS Variable
    $color_css = '';
    // Top Bar
    if (isset($theme_options['top_bar_top_border']) and $theme_options['top_bar_top_border'] <> $theme_def['top_bar_top_border']) :
        $color_css .= '
            #topnavbar {
                border-top: 1px solid ' . $theme_options['top_bar_bottom_border'] . ';
            }';
    endif;
    if (isset($theme_options['top_bar_bottom_border']) and $theme_options['top_bar_bottom_border'] <> $theme_def['top_bar_bottom_border']) :
        $color_css .= '
            #topnavbar {
                border-bottom: 1px solid ' . $theme_options['top_bar_bottom_border'] . ';
            }';
    endif;
    if (isset($theme_options['top_bar_bg']) and $theme_options['top_bar_bg'] <> $theme_def['top_bar_bg']) :
        $color_css .= '
            #topnavbar {
                background: ' . $theme_options['top_bar_bg'] . ';
            }';
    endif;
    if (isset($theme_options['top_bar_font_color']) and $theme_options['top_bar_font_color'] <> $theme_def['gen_nav_font_color']) :
        $color_css .= '
            #topnavbar p, #topnavbar #header-social-icons .social-icons-menu li a:before {
                color: ' . $theme_options['top_bar_font_color'] . ';
            }';
    endif;
    // Top Nav
    if (isset($theme_options['topnav_color']) and $theme_options['topnav_color'] <> $theme_def['topnav_color']) :
        $color_css .= '
            #topnav, #topnav-icon, #topheader {
                background: ' . $theme_options['topnav_color'] . ';
            }';
    endif;
    if (isset($theme_options['topnav_current']) and $theme_options['topnav_current'] <> $theme_def['topnav_current']) :
        $color_css .= '
            #topnav-menu .current_page_item, #topnav-menu .current-menu-item {
                background: ' . $theme_options['topnav_current'] . ';
            }';
    endif;
    if (isset($theme_options['topnav_hover']) and $theme_options['topnav_hover'] <> $theme_def['topnav_hover']) :
        $color_css .= '
            #topnav-menu a:hover, #topnav-menu li a:hover {
                background: ' . $theme_options['topnav_hover'] . ';
            }';
    endif;
    if (isset($theme_options['topnav_dropdown']) and $theme_options['topnav_dropdown'] <> $theme_def['topnav_dropdown']) :
        $color_css .= '
            #topnav-menu .sub-menu, #topnav-menu .children {
                background-color: ' . $theme_options['topnav_dropdown'] . ';
            }';
    endif;
    if (isset($theme_options['topnav_drophov']) and $theme_options['topnav_drophov'] <> $theme_def['topnav_drophov']) :
        $color_css .= '
            ul#topnav-menu ul a:hover, #topnav-menu ul ul a:hover, ul#topnav-menu ul a:focus, #topnav-menu ul ul a:focus {
                background-color: ' . $theme_options['topnav_drophov'] . ';
            }';
    endif;
    if (isset($theme_options['topnav_dropbor']) and $theme_options['topnav_dropbor'] <> $theme_def['topnav_dropbor']) :
        $color_css .= '
            ul#topnav-menu ul a, #topnav-menu ul ul a {
                border-top: 1px solid' . $theme_options['topnav_dropbor'] . ';
            }
            #topnav-menu .sub-menu, #topnav-menu .children {
                border-color: ' . $theme_options['topnav_dropbor'] . ';
            }';
    endif;
    if (isset($theme_options['topnav_text_color']) and $theme_options['topnav_text_color'] <> $theme_def['gen_nav_font_color']) :
        $color_css .= '
            #topnav-menu a:link, #topnav-menu a:visited, #header-social-icons .social-icons-menu li a:before {
                color: ' . $theme_options['topnav_text_color'] . ';
            @media only screen and (max-width:60em) {
                .menu-toggle, .menu-toggle:active, .menu-toggle:focus, .menu-toggle:hover {
                color: ' . $theme_options['topnav_text_color'] . ';
                }}
            }';
    endif;
    // Main Navigation
    if (isset($theme_options['navi_text_color']) and $theme_options['navi_text_color'] <> $theme_def['gen_nav_font_color']) :
        $color_css .= '
            .nav-menu li a, 
            .nav-menu .current_page_ancestor > a, 
            .nav-menu .current-menu-ancestor > a,
            .search-icon:before,
            .nav-menu li.menu-item-has-children > a:after,
            .nav-menu .submenu li.menu-item-has-children > a:after,
            #header #navi-wrap .nav-menu li a,
            #header .search-icon:before,
            #header #navi-wrap .nav-menu li.menu-item-has-children > a:after,
            #header #navi-wrap .nav-menu .submenu li.menu-item-has-children > a:after {
                color: ' . $theme_options['navi_text_color'] . ';
            }
            @media only screen and (max-width:60em) {
            .menu-toggle, .menu-toggle:active, .menu-toggle:focus, .menu-toggle:hover, #header .menu-toggle {
                color: ' . $theme_options['navi_text_color'] . ';
                }
            }';
    endif;
    if (isset($theme_options['navi_hover']) and $theme_options['navi_hover'] <> $theme_def['navi_hover']) :
        $color_css .= '
            .nav-menu li:hover > a, .nav-menu li a:hover, .nav-menu li:focus > a, .nav-menu li a:focus {
                background: ' . $theme_options['navi_hover'] . ';
            }';
    endif;
    if (isset($theme_options['navi_color']) and $theme_options['navi_color'] <> $theme_def['navi_color']) :
        $color_css .= '
            #navi-wrap, .natty #navi-wrap, .stickynav {
                background: ' . $theme_options['navi_color'] . ';
            }';
    endif;
    // Main Menu TOP Border Color
    if ( isset($theme_options['navi_top_bd_enb']) and $theme_options['navi_top_bd_enb'] == $theme_def['navi_top_bd_enb'] ) :
        if (isset($theme_options['navi_top_bd_clr']) and $theme_options['navi_top_bd_clr'] <> $theme_def['navi_top_bd_clr']) :
            $color_css .= '
            #navi-wrap, .natty #navi-wrap, .stickynav {
                border-top: ' . $theme_options['navi_top_bd_hei'] . 'px solid ' . $theme_options['navi_top_bd_clr'] . '; 
            }';
        endif;
    endif;
    // Main Menu Bottom Border Color
    if ( isset($theme_options['navi_bot_bd_enb']) and $theme_options['navi_bot_bd_enb'] == $theme_def['navi_bot_bd_enb'] ) :
        if (isset($theme_options['navi_bot_bd_clr']) and $theme_options['navi_bot_bd_clr'] <> $theme_def['navi_bot_bd_clr']) :
            $color_css .= '
            #navi-wrap, .natty #navi-wrap, .stickynav {
                border-bottom: ' . $theme_options['navi_bot_bd_hei'] . 'px solid ' . $theme_options['navi_bot_bd_clr'] . ';
            }';
        endif;
    endif;
    // Menu Item Border
    if ( isset($theme_options['navi_border_enable']) and $theme_options['navi_border_enable'] == true ) :
        if ( isset($theme_options['navi_border']) and $theme_options['navi_border'] <> $theme_def['navi_border'] ) :
            $color_css .= '
            .nav-menu li {
                border-left: 1px solid ' . $theme_options['navi_border'] . ';
                border-right: none;
            }
            .nav-menu li:last-child, .wide-header .nav-menu li:last-child {
                border-right: 1px solid ' . $theme_options['navi_border'] . ';
            }
            .wide-header .nav-menu li:first-child {
                border-left: 1px solid ' . $theme_options['navi_border'] . ';
            }';
        else:
            $color_css .= '
            .nav-menu li {
            border-right: 1px solid rgba(255, 255, 255, 0.2);
                border-left: 1px solid rgba(0, 0, 0, 0.2);
            }
            .nav-menu li:first-child {
            border-left: 1px solid rgba(255, 255, 255, 0.2);
            }
            .nav-menu li:last-child {
            border-right: 1px solid rgba(255, 255, 255, 0.2);
            }
            .wide-header .nav-menu li:first-child {
                border-left: 1px solid rgba(157, 157, 157, 0.35);
            }
            .wide-header .nav-menu li:last-child {
                border-right: 1px solid rgba(157, 157, 157, 0.35);
            }';
        endif;
    endif;
    // Menu Dropdown Border
    if (isset($theme_options['navi_dropdown']) and $theme_options['navi_dropdown'] <> $theme_def['navi_dropdown']) :
        $color_css .= '
            .nav-menu .sub-menu, .nav-menu .children {
                background: ' . $theme_options['navi_dropdown'] . ';
            }';
    endif;
    if (isset($theme_options['navi_drophov']) and $theme_options['navi_drophov'] <> $theme_def['navi_drophov']) :
        $color_css .= '
            ul.nav-menu ul a:hover, .nav-menu ul ul a:hover, ul.nav-menu ul a:focus, .nav-menu ul ul a:focus {
                background-color: ' . $theme_options['navi_drophov'] . ';
            }';
    endif;
    if ( isset($theme_options['navi_dropdown_noborder']) and $theme_options['navi_dropdown_noborder'] == $theme_def['navi_dropdown_noborder'] ) :
        if (isset($theme_options['navi_dropdown_border']) and $theme_options['navi_dropdown_border'] <> $theme_def['navi_dropdown_border']) :
        $color_css .= '
            .nav-menu .sub-menu, .nav-menu .children {
                border: 2px solid ' . $theme_options['navi_dropdown_border'] . ';
            }
            .nav-menu .sub-menu ul, .nav-menu .children ul {
                border-left: 1px solid ' . $theme_options['navi_dropdown_border'] . ';
            }
            ul.nav-menu ul a, .nav-menu ul ul a {
                border-top: 1px solid ' . $theme_options['navi_dropdown_border'] . ';
            }
            .toggled-on li, .toggled-on .children {
                border-top: 1px solid ' . $theme_options['navi_dropdown_border'] . ';
                border-left: 1px solid ' . $theme_options['navi_dropdown_border'] . ';
            }';
        endif;
    else:
        $color_css .= '
            .nav-menu .sub-menu, .nav-menu .children {
                border: 0;
            }
            .nav-menu .sub-menu ul, .nav-menu .children ul {
                border-left: 0;
            }
            ul.nav-menu ul a, .nav-menu ul ul a {
                border-top: 1px solid rgba(255, 255, 255, 0.2);
            }
            .toggled-on li, .toggled-on .children {
                border-top: 1px solid rgba(255, 255, 255, 0.2);
                border-left: 0;
            }';
    endif;
    // Header
    if ( isset($theme_options['header_line_enable']) and $theme_options['header_line_enable'] == true ) :
        if (isset($theme_options['headline_top_border']) and $theme_options['headline_top_border'] <> $theme_def['headline_top_border']) :
            $color_css .= '.header-line {border-top: ' . $theme_options['headline_top_bor_height'] . 'px solid ' . $theme_options['headline_top_border'] . ';}';
        endif;
        if (isset($theme_options['headline_bottom_border']) and $theme_options['headline_bottom_border'] <> $theme_def['headline_bottom_border']) :
            $color_css .= '.header-line {border-bottom: 1px solid ' . $theme_options['headline_bottom_border'] . ';}';
        endif;
    endif;
    // Header Gradient
    if (isset($theme_options['header_gradient_enable']) and $theme_options['header_gradient_enable'] == true ) :
        $hgr_dir = esc_attr($theme_options['header_gr_dir']);
        $color_css .= '
            #header-wrap, .natty #header-wrap {
                background: linear-gradient('. $hgr_dir .', '. $theme_options['header_backgr'] .', '. $theme_options['header_grad_ient'] .');
                background: -webkit-linear-gradient('. $hgr_dir .', '. $theme_options['header_backgr'] .', '. $theme_options['header_grad_ient'] .');
                background: -o-linear-gradient('. $hgr_dir .', '. $theme_options['header_backgr'] .', '. $theme_options['header_grad_ient'] .');
                background: -moz-linear-gradient('. $hgr_dir .', '. $theme_options['header_backgr'] .', '. $theme_options['header_grad_ient'] .');
            }';
    else:
        if ( isset($theme_options['header_backgr']) and $theme_options['header_backgr'] <> $theme_def['header_backgr'] ) :
            $color_css .= '
            #header-wrap, .natty #header-wrap {
                background: '. $theme_options['header_backgr'] .';
            }';
        endif;
    endif;
    // Site Title
    if ( isset($theme_options['site_title_color']) and $theme_options['site_title_color'] <> $theme_def['site_title_color'] ) :
        $color_css .= '
            #logo .site-title, #logo a:hover .site-title {
                color: '. $theme_options['site_title_color'] .';
            }';
    endif;
    if ( isset($theme_options['site_title_shadis']) and $theme_options['site_title_shadis'] == true) :
        $color_css .= '
            #logo .site-title, #logo a:hover .site-title {
                text-shadow: 1px 1px 0 '. $theme_options['site_title_shadow'] .';
            }';
    else:
        $color_css .= '
            #logo .site-title, #logo a:hover .site-title {
                text-shadow: 0 0;
            }';
    endif;
    if ( isset($theme_options['site_tagline_color']) and $theme_options['site_tagline_color'] <> $theme_def['site_tagline_color'] ) :
        $color_css .= '
            #logo .site-description {
                color: '. $theme_options['site_tagline_color'] .';
            }';
    endif;
    // General
	if ( isset($theme_options['default_text_color']) and $theme_options['default_text_color'] <> $theme_def['default_text_color'] ) :
		$color_css .= '
            body, input, textarea {
                color: '. $theme_options['default_text_color'] .';
            }';
	endif;
	if ( isset($theme_options['title_color']) and $theme_options['title_color'] <> $theme_def['title_color'] ) :
		$color_css .= '
            .page-title, .post-title, .post-title a:link, .post-title a:visited, .archive-title span, .archive-title {
                color: '. $theme_options['title_color'] .';
            }
            .post-title a:hover, .post-title a:active {
                color: '. $theme_options['title_color'] .';
            }';
	endif;
	if ( isset($theme_options['link_color']) and $theme_options['link_color'] <> $theme_def['link_color'] ) :
		$color_css .= '
            a, a:link, a:visited, .comment a:link, .comment a:visited,.post-pagination a:link,
            .post-pagination a:visited, #image-nav .nav-previous a, #image-nav .nav-next a,
            .postmeta a:link, .postmeta a:visited {
                color: '. $theme_options['link_color'] .';
            }
            .post-pagination .current {
                background-color: '. $theme_options['link_color'] .';
            }';
	endif;
    if ( isset($theme_options['body_borders_color']) and $theme_options['body_borders_color'] <> $theme_def['body_borders_color'] ) :
        $color_css .= '
            .wide-header #content-wrap {
                border: 1px solid '. $theme_options['body_borders_color'] .';
            }';
    endif;
    // Scroll to Top Color
    if ( isset($theme_options['sctop_bg_color']) and $theme_options['sctop_bg_color'] <> $theme_def['sctop_bg_color'] ) :
        $color_css .= '
            .scrollToTop {
                background: '. $theme_options['sctop_bg_color'] .';
                opacity: 0.85;
            }';
    endif;
    if ( isset($theme_options['sctop_brdr_color']) and $theme_options['sctop_brdr_color'] <> $theme_def['sctop_brdr_color'] ) :
        $color_css .= '
            .scrollToTop {
                border: 3px solid '. $theme_options['sctop_brdr_color'] .';
                opacity: 0.9;
            }';
    endif;
    if ( isset($theme_options['sctop_arrow_color']) and $theme_options['sctop_arrow_color'] <> $theme_def['sctop_arrow_color'] ) :
        $color_css .= '
            .scrollToTop:before {
                color: '. $theme_options['sctop_arrow_color'] .';
            }';
    endif;
    if ( isset($theme_options['sctop_hover_color']) and $theme_options['sctop_hover_color'] <> $theme_def['sctop_hover_color'] ) :
        $color_css .= '
            .scrollToTop:hover {
                background: '. $theme_options['sctop_hover_color'] .';
            }';
    endif;
    // Comment Button Color
    if ( isset($theme_options['cmbtn_bg_color']) and $theme_options['cmbtn_bg_color'] <> $theme_def['cmbtn_bg_color'] ) :
        $color_css .= '
            #commentform #submit {
                background: '. $theme_options['cmbtn_bg_color'] .';
            }';
    endif;
    if ( isset($theme_options['cmbtn_text_color']) and $theme_options['cmbtn_text_color'] <> $theme_def['cmbtn_text_color'] ) :
        $color_css .= '
            #commentform #submit {
                color: '. $theme_options['cmbtn_text_color'] .';
            }';
    endif;
    if ( isset($theme_options['cmbtn_btn_hover']) and $theme_options['cmbtn_btn_hover'] <> $theme_def['cmbtn_btn_hover'] ) :
        $color_css .= '
            #commentform #submit:hover {
                background: '. $theme_options['cmbtn_btn_hover'] .';
            }';
    endif;
    // Front Page Colors
    // Slider Caption Title Color
    if ( isset($theme_options['sldr_title_clr']) and $theme_options['sldr_title_clr'] <> $theme_def['sldr_title_clr'] ) :
        $color_css .= '
            #frontpage-slider .pmsslide .slide-entry .slide-title a:link, #frontpage-slider .pmsslide .slide-entry .slide-title a:visited{
                color: '. $theme_options['sldr_title_clr'].';
            }';
    endif;
    // Slider Caption Text Color
    if ( isset($theme_options['sldr_text_clr']) and $theme_options['sldr_text_clr'] <> $theme_def['sldr_text_clr'] ) :
        $color_css .= '
            #frontpage-slider .pmsslide .slide-entry, #frontpage-slider .pmsslide .slide-entry .slide-more-link, #frontpage-slider .pmsslide .slide-entry .slide-more-link:link{
                color: '. $theme_options['sldr_text_clr'].';
            }';
    endif;
    // Slider Caption Background Color
    if ( isset($theme_options['sldr_bg_clr']) and $theme_options['sldr_bg_clr'] <> $theme_def['sldr_bg_clr'] ) :
        $color_css .= '
            #frontpage-slider .pmsslide .slide-entry{
                background: '. $theme_options['sldr_bg_clr'].';
                opacity: 0.75;
            }';
    endif;
    // Slider Arrow Colors
    if ( isset($theme_options['sldr_arrow_clr']) and $theme_options['sldr_arrow_clr'] <> $theme_def['sldr_arrow_clr'] ) :
        $color_css .= '
            .frontpage-slider-controls .pmsflex-direction-nav a:before{
                color: '. $theme_options['sldr_arrow_clr'].';
            }';
    endif;
    // Slider Arrow Background Color
    if ( isset($theme_options['sldr_arrow_bg_clr']) and $theme_options['sldr_arrow_bg_clr'] <> $theme_def['sldr_arrow_bg_clr'] ) :
        $color_css .= '
            .frontpage-slider-controls .pmsflex-direction-nav a {
                background: '. $theme_options['sldr_arrow_bg_clr'].';
                opacity: 0.75;
            }';
    endif;
    // Slider Border Color
    if ( isset($theme_options['sldr_border_clr']) and $theme_options['sldr_border_clr'] <> $theme_def['sldr_border_clr'] ) :
        $color_css .= '
            #frontpage-slider {
                border: 1px solid '. $theme_options['sldr_border_clr'].';
            }';
    endif;
    if ( isset($theme_options['frontbar_font_clr']) and $theme_options['frontbar_font_clr'] <> $theme_def['frontbar_font_clr'] ) :
        $color_css .= '
            #frontpage-magazine-widgets .widget .widgettitle {
                color: '. $theme_options['frontbar_font_clr'].';
            }';
    endif;
    // More Frontpage Widget Header Styling
    if ( isset($theme_options['frontpage_header_style']) and $theme_options['frontpage_header_style'] == true ) :
        if ( isset($theme_options['frontbar_bg_color']) and $theme_options['frontbar_bg_color'] <> $theme_def['frontbar_bg_color'] ) :
            $color_css .= '
                #frontpage-magazine-widgets .widget .widgettitle {
                    background: '. $theme_options['frontbar_bg_color'] .';
                    display: inline-block;
                    margin: 0;
                }
                ';
        endif;
        if ( isset($theme_options['front_header_bg_color']) and $theme_options['front_header_bg_color'] <> $theme_def['front_header_bg_color'] ) :
            $color_css .= '
                #frontpage-magazine-widgets .widget .widget-header {
                    background: '. $theme_options['front_header_bg_color'] .';
                    margin: -0.5em -0.5em 1em;
                }';
        endif;
        if ( isset($theme_options['front_header_top_border']) and $theme_options['front_header_top_border'] <> $theme_def['front_header_top_border'] ) :
            $color_css .= '
                #frontpage-magazine-widgets .widget .widget-header {
                    border-top: 2px solid '. $theme_options['front_header_top_border'] .';
                    margin: -0.5em -0.5em 1em;
                }';
        endif;
        if ( isset($theme_options['front_header_bot_border']) and $theme_options['front_header_bot_border'] <> $theme_def['front_header_bot_border'] ) :
            $color_css .= '
                #frontpage-magazine-widgets .widget .widget-header {
                    border-bottom: 2px solid '. $theme_options['front_header_bot_border'] .';
                    margin: -0.5em -0.5em 1em;
                }';
        endif;
    else:
        if ( isset($theme_options['frontbar_bg_color']) and $theme_options['frontbar_bg_color'] <> $theme_def['frontbar_bg_color'] ) :
            $color_css .= '
            #frontpage-magazine-widgets .widget .widgettitle {
                background: '. $theme_options['frontbar_bg_color'] .';
            }';
        endif;
    endif;
    // Sidebar Widgets
	if ( isset($theme_options['widget_title_color']) and $theme_options['widget_title_color'] <> $theme_def['widget_title_color'] ) :
		$color_css .= '
            #sidebar .widgettitle {
                color: '. $theme_options['widget_title_color'].';
            }';
	endif;
	// More Sidebar Widget Header Styling
    if ( isset($theme_options['widget_header_styling']) and $theme_options['widget_header_styling'] == true ) :
        if ( isset($theme_options['widget_header_color']) and $theme_options['widget_header_color'] <> $theme_def['widget_header_color'] ) :
            $color_css .= '
                #sidebar .widgettitle {
                    background: '. $theme_options['widget_header_color'] .';
                    display: inline-block;
                    margin: 0;
                }
                ';
        endif;
        if ( isset($theme_options['widget_header_bg_color']) and $theme_options['widget_header_bg_color'] <> $theme_def['widget_header_bg_color'] ) :
            $color_css .= '
                #sidebar .widget-header {
                    background: '. $theme_options['widget_header_bg_color'] .';
                    margin: -0.5em -0.5em 1em;
                }';
        endif;
        if ( isset($theme_options['widget_header_top_border']) and $theme_options['widget_header_top_border'] <> $theme_def['widget_header_top_border'] ) :
            $color_css .= '
                #sidebar .widget-header{
                    border-top: 2px solid '. $theme_options['widget_header_top_border'] .';
                    margin: -0.5em -0.5em 1em;
                }';
        endif;
        if ( isset($theme_options['widget_header_bot_border']) and $theme_options['widget_header_bot_border'] <> $theme_def['widget_header_bot_border'] ) :
            $color_css .= '
                #sidebar .widget-header {
                    border-bottom: 2px solid '. $theme_options['widget_header_bot_border'] .';
                    margin: -0.5em -0.5em 1em;
                }';
        endif;
    else:
        if ( isset($theme_options['widget_header_color']) and $theme_options['widget_header_color'] <> $theme_def['widget_header_color'] ) :
            $color_css .= '
            #sidebar .widgettitle {
                background: '. $theme_options['widget_header_color'] .';
            }';
        endif;
    endif;

    // Widget Link Color
	if ( isset($theme_options['widget_link_color']) and $theme_options['widget_link_color'] <> $theme_def['widget_link_color'] ) :
		$color_css .= '
            #sidebar .widget .rp-title a:link, #sidebar .widget .rp-title a:visited, .product_list_widget .product-title {
                color: '. $theme_options['widget_link_color'].';
            }';
	endif;
    // Widget Text Color
	if ( isset($theme_options['widget_text_color']) and $theme_options['widget_text_color'] <> $theme_def['widget_text_color'] ) :
		$color_css .= '
            .widget ul, #sidebar .widget .textwidget {
                color: '. $theme_options['widget_text_color'].';
            }';
	endif;
    // Widget Post Meta Color
    if ( isset($theme_options['widget_post_meta_clr']) and $theme_options['widget_post_meta_clr'] <> $theme_def['widget_post_meta_clr'] ) :
        $color_css .= '
            .widget-posts-entries .widget-postmeta,
            .widget-posts-entries .widget-postmeta a:link,
            .widget-posts-entries .widget-postmeta span:before {
                color: '. $theme_options['widget_post_meta_clr'].';
            }';
    endif;
    // Widget Background Color
	if ( isset($theme_options['widget_backgr_color']) and $theme_options['widget_backgr_color'] <> $theme_def['widget_backgr_color'] ) :
		$color_css .= '
            #sidebar .widget:not(.pmthemes_tabbed_content) {
                background: '. $theme_options['widget_backgr_color'].';
            }';
	endif;
    // Sidebar
    if (isset($theme_options['sidebar_gradient_enable']) and $theme_options['sidebar_gradient_enable'] == true) :
        $color_css .= '
            #sidebar, .rlayout #sidebar {
                background: '. $theme_options['sidebar_background'] .';
                background: linear-gradient('. $theme_options['sidebar_gr_dir'] .', '. $theme_options['sidebar_background'] .', '. $theme_options['sidebar_grad_ient'] .');
                background: -webkit-linear-gradient('. $theme_options['sidebar_gr_dir'] .', '. $theme_options['sidebar_background'] .', '. $theme_options['sidebar_grad_ient'] .');
                background: -o-linear-gradient('. $theme_options['sidebar_gr_dir'] .', '. $theme_options['sidebar_background'] .', '. $theme_options['sidebar_grad_ient'] .');
                background: -moz-linear-gradient('. $theme_options['sidebar_gr_dir'] .', '. $theme_options['sidebar_background'] .', '. $theme_options['sidebar_grad_ient'] .');
            }';
    else:
        if ( isset($theme_options['sidebar_background']) and $theme_options['sidebar_background'] <> $theme_def['sidebar_background'] ) :
            $color_css .= '
            #sidebar, .rlayout #sidebar {
                background: '. $theme_options['sidebar_background'].';
            }';
        endif;
    endif;

    // Sidebar Borders
    if (isset($theme_options['show_sidebar_border']) and $theme_options['show_sidebar_border'] == true) :
        if ( isset($theme_options['sidebar_border_color']) and $theme_options['sidebar_border_color'] <> '' ) :
            $color_css .= '
            #sidebar .widget {
                border: '. $theme_options['sidebar_border_thick'].'px solid '. $theme_options['sidebar_border_color'].';
            }';
        elseif ( isset($theme_options['sidebar_border_thick']) and $theme_options['sidebar_border_thick'] == '0' ) :
            $color_css .= '
            #sidebar .widget,
            #sidebar .sideleft .widget,
            #sidebar .sideright .widget {
                border: none;
            }
            #sidebar .widget {
                padding: 1em 0;
            }';
        endif;
    endif;

    // =========Tabbed Widget===========//
    // Tabbed Background Color
    if ( isset($theme_options['tabbed_bg_color']) and $theme_options['tabbed_bg_color'] <> $theme_def['tabbed_bg_color'] ) :
        $color_css .= '
                .widget.pmthemes_tabbed_content {
                    background: '. $theme_options['tabbed_bg_color'] .';
                }
                ';
    endif;
    // Tabbed Header Color
    if ( isset($theme_options['tabbed_header_color']) and $theme_options['tabbed_header_color'] <> $theme_def['tabbed_header_color'] ) :
        $color_css .= '
                .widget-tabnavi, .widget-tabnav {
                    background: '. $theme_options['tabbed_header_color'] .';
                }
                ';
    endif;
    // Tabbed Header Title Color
    if ( isset($theme_options['tabbed_hdtl_color']) and $theme_options['tabbed_hdtl_color'] <> $theme_def['tabbed_hdtl_color'] ) :
        $color_css .= '
                #sidebar .widget.pmthemes_tabbed_content .widget-tabnav a:link {
                    color: '. $theme_options['tabbed_hdtl_color'] .';
                }
                ';
    endif;
    // Tabbed Link Color
    if ( isset($theme_options['tabbed_linked_color']) and $theme_options['tabbed_linked_color'] <> $theme_def['tabbed_linked_color'] ) :
        $color_css .= '
                #sidebar .widget.pmthemes_tabbed_content .tabdiv a:link{
                    color: '. $theme_options['tabbed_linked_color'] .';
                }
                ';
    endif;
    // Tabbed Post Meta Color
    if ( isset($theme_options['tabbed_post_meta_clr']) and $theme_options['tabbed_post_meta_clr'] <> $theme_def['tabbed_post_meta_clr'] ) :
        $color_css .= '
                .widget-tabbed .tabdiv ul li .widget-postmeta,
                .widget-tabbed .tabdiv ul li .widget-postmeta:before {
                    color: '. $theme_options['tabbed_post_meta_clr'] .';
                }
                ';
    endif;
    // =========Footer Widgets===========//
    // Footer Widgets Gradient
    if (isset($theme_options['fwidget_gradient_enable']) and $theme_options['fwidget_gradient_enable'] == true ) :
        $color_css .= '
            #footer-widgets-bg {
                background: '. $theme_options['footer_widgets_color'] .';
                background: linear-gradient('. $theme_options['fwidget_gr_dir'] .', '. $theme_options['footer_widgets_color'] .', '. $theme_options['fwidget_grad_ient'] .');
                background: -webkit-linear-gradient('. $theme_options['fwidget_gr_dir'] .', '. $theme_options['footer_widgets_color'] .', '. $theme_options['fwidget_grad_ient'] .');
                background: -o-linear-gradient('. $theme_options['fwidget_gr_dir'] .', '. $theme_options['footer_widgets_color'] .', '. $theme_options['fwidget_grad_ient'] .');
                background: -moz-linear-gradient('. $theme_options['fwidget_gr_dir'] .', '. $theme_options['footer_widgets_color'] .', '. $theme_options['fwidget_grad_ient'] .');
            }';
    else:
        if ( isset($theme_options['footer_widgets_color']) and $theme_options['footer_widgets_color'] <> $theme_def['footer_widgets_color'] ) :
            $color_css .= '
            #footer-widgets-bg {
                background: '.  $theme_options['footer_widgets_color'] .';
            }';
        endif;
    endif;
    if ( isset($theme_options['footer_each_widget']) and $theme_options['footer_each_widget'] <> $theme_def['footer_each_widget'] ) :
        $color_css .= '
            #footer-widgets .widget {
                background: '.  $theme_options['footer_each_widget'] .';
            }';
    endif;
    if ( isset($theme_options['footer_widgets_header_title']) and $theme_options['footer_widgets_header_title'] <> $theme_def['gen_head_font_color'] ) :
        $color_css .= '
            #footer-widgets .widgettitle {
                color: '.  $theme_options['footer_widgets_header_title'] .';
            }';
    endif;
    if ( isset($theme_options['footer_widgets_header_bg']) and $theme_options['footer_widgets_header_bg'] <> $theme_def['footer_widgets_header_bg'] ) :
        $color_css .= '
            #footer-widgets .widgettitle {
                background: '.  $theme_options['footer_widgets_header_bg'] .';
            }';
    endif;
	if ( isset($theme_options['footer_texts_borders']) and $theme_options['footer_texts_borders'] <> $theme_def['footer_texts_borders'] ) :
		$color_css .= '
            #footer-widgets .widget ul li {
                border-bottom: 1px solid '.  $theme_options['footer_texts_borders'] .';
            }';
	endif;	
	if ( isset($theme_options['footer_widgets_texts']) and $theme_options['footer_widgets_texts'] <> $theme_def['footer_widgets_texts'] ) :
		$color_css .= '
            #footer-widgets .widget a:link, #footer-widgets .widget a:visited, #footer-widgets .product-title {
                color: '.  $theme_options['footer_widgets_texts'] .';
            }';
	endif;
    if ( isset($theme_options['footer_widgets_pltxt']) and $theme_options['footer_widgets_pltxt'] <> $theme_def['footer_widgets_pltxt'] ) :
        $color_css .= '
            #footer-widgets .widget div, #footer-widgets .widget ul {
                color: '.  $theme_options['footer_widgets_pltxt'] .';
            }';
    endif;
	if ( isset($theme_options['footer_texts_colol']) and $theme_options['footer_texts_colol'] <> $theme_def['footer_texts_colol'] ) :
		$color_css .= '
            #footer-text, #footer-text a:link, #footer-text a:visited, #footernav-menu a:link, #footernav-menu a:visited, #footernav-menu li:before {
                color: '.  $theme_options['footer_texts_colol'] .';
            }';
	endif;
	if ( isset($theme_options['footer_color']) and $theme_options['footer_color'] <> $theme_def['footer_color'] ) :
		$color_css .= '
            #footer {
                background: '. $theme_options['footer_color'] .';
            }';
	endif;
	if ( isset($theme_options['footer_top_brdr']) and $theme_options['footer_top_brdr'] <> $theme_def['footer_top_brdr'] ) :
		$color_css .= '
            #footer {
                border-top: '. $theme_options['footer_top_brdr_hei'] .'px solid '. $theme_options['footer_top_brdr'] .';
            }';
	endif;
    if ( isset($theme_options['footer_bottom_brdr']) and $theme_options['footer_bottom_brdr'] <> $theme_def['footer_bottom_brdr'] ) :
        $color_css .= '
            #footer {
                border-bottom: '. $theme_options['footer_bot_brdr_hei'] .'px solid '. $theme_options['footer_bottom_brdr'] .';
            }';
    endif;

	// Print Color CSS
    if ( $color_css ) {
        wp_add_inline_style( 'pmthemes-custom', $color_css );
    }
}