Yuzu Theme

from meowapps.com
This commit is contained in:
2022-05-03 09:37:05 +02:00
commit 523ccac38e
75 changed files with 15482 additions and 0 deletions

73
inc/apply-colors.php Normal file
View File

@@ -0,0 +1,73 @@
<?php
function convert_hex_to_rgba($color, $opacity = false) {
$default = 'rgb(0,0,0)';
//Return default if no color provided
if(empty($color))
return $default;
//Sanitize $color if "#" is provided
if ($color[0] == '#' ) {
$color = substr( $color, 1 );
}
//Check if color has 6 or 3 characters and get values
if (strlen($color) == 6) {
$hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
} elseif ( strlen( $color ) == 3 ) {
$hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
} else {
return $default;
}
//Convert hexadec to rgb
$rgb = array_map('hexdec', $hex);
//Check if opacity is set(rgba or rgb)
if($opacity){
if(abs($opacity) > 1)
$opacity = 1.0;
$output = 'rgba('.implode(",",$rgb).','.$opacity.')';
} else {
$output = 'rgb('.implode(",",$rgb).')';
}
//Return rgb(a) color string
return $output;
}
function yuzu_customizer_head_styles() {
?>
<style type="text/css" class="customizer-colors">
body.custom-theme {
--top_bar_color: <?= get_theme_mod('top_bar_color', '#2E3B4F'); ?>;
--body_color: <?= get_theme_mod('body_color', '#2E3B4F'); ?>;
--footer_color: <?= get_theme_mod('footer_color', '#2E3B4F'); ?>;
--card_color: <?= get_theme_mod('card_color', '#2E3B4F'); ?>;
--link_color: <?= get_theme_mod('link_color', '#4B828E'); ?>;
--link_hover_color: <?= get_theme_mod('link_hover_color', '#39636D'); ?>;
--tag_color: <?= get_theme_mod('tag_color', '#4B828E'); ?>;
--tag_hover_color: <?= get_theme_mod('tag_hover_color', '#39636D'); ?>;
--search_widget_color: <?= get_theme_mod('search_widget_color', '#2E3B4F'); ?>;
--read_more_btn_color: <?= get_theme_mod('read_more_btn_color', '#2E3B4F'); ?>;
--comment_color: <?= get_theme_mod('comment_color', '#2E3B4F'); ?>;
--comment_form_color: <?= get_theme_mod('comment_form_color', '#2E3B4F'); ?>;
--post_comment_btn_color: <?= get_theme_mod('comment_form_color', '#2E3B4F'); ?>;
--top_bar_bg: <?= get_theme_mod('top_bar_bg', '#fff'); ?>;
--body_bg: <?= get_theme_mod('body_bg', '#FAFBFB'); ?>;
--very_opaque_header_bg: linear-gradient(to top, <?= convert_hex_to_rgba(get_theme_mod('body_bg', '#FAFBFB'), 1) ?>, <?= convert_hex_to_rgba(get_theme_mod('body_bg', '#FAFBFB'), .9) ?>);
--opaque_header_bg: linear-gradient(to top, <?= convert_hex_to_rgba(get_theme_mod('body_bg', '#FAFBFB'), 1) ?>, <?= convert_hex_to_rgba(get_theme_mod('body_bg', '#FAFBFB'), .6) ?>);
--less_opaque_header_bg: linear-gradient(to top, <?= convert_hex_to_rgba(get_theme_mod('body_bg', '#FAFBFB'), 1) ?>, <?= convert_hex_to_rgba(get_theme_mod('body_bg', '#FAFBFB'), .4) ?>);
--footer_bg: <?= get_theme_mod('footer_bg', '#FFF'); ?>;
--card_bg: <?= get_theme_mod('card_bg', '#FFF'); ?>;
--search_widget_bg: <?= get_theme_mod('search_widget_bg', '#f5f4f4'); ?>;
--read_more_btn_bg: <?= get_theme_mod('read_more_btn_bg', '#F5F5F5'); ?>;
--comment_bg: <?= get_theme_mod('comment_bg', '#FFF'); ?>;
--comment_form_bg: <?= get_theme_mod('comment_form_bg', '#FFF'); ?>;
--post_comment_btn_bg: <?= get_theme_mod('comment_form_bg', '#FFF'); ?>;
}
</style>
<?php
}
add_action( 'wp_head', 'yuzu_customizer_head_styles' );