add support for custom color

This commit is contained in:
Jonas Heinrich 2020-04-15 20:25:31 +02:00
parent e8f3b2c328
commit cb3b475b9d
5 changed files with 62 additions and 176 deletions

View file

@ -112,3 +112,64 @@ class kit_custom_main_menu extends Walker_Nav_Menu {
}
}
function theme_customize_register( $wp_customize ) {
$wp_customize->add_setting( 'theme_color', array(
'default' => '#009982',
'transport' => 'refresh',
) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'theme_color', array(
'section' => 'colors',
'label' => esc_html__( 'Theme color', 'theme' ),
) ) );
}
add_action( 'customize_register', 'theme_customize_register' );
function kit_customize_css()
{
?>
<style type="text/css">
aside .aside-icon {
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
}
nav > ul > li:hover > a,
nav > ul > li:active > a {
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
}
nav > ul > li:hover > a::after,
nav > ul > li:active > a::after {
border-bottom: 4px solid <?php echo get_theme_mod('theme_color', '#009982'); ?>;
}
.header-button {
/* background-image: linear-gradient(0deg, <?php echo get_theme_mod('theme_color', '#009982'); ?>, rgb(0,0,0,0.2)); */
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
box-shadow: inset 0 14px 16px -16px white;
}
.nav-second-level-group-headline {
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
}
.opened > a {
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
}
nav > ul > li .nav-first-level-opener::before, nav > ul > li .nav-first-level-opener::after {
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
}
.nav-second-level .nav-second-level-opener::before, .nav-second-level .nav-second-level-opener::after {
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
}
</style>
<?php
}
add_action( 'wp_head', 'kit_customize_css');