-
-
Save spencerfinnell/3c026a832835203759be183afbc7d5b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get color configs. | |
* | |
* @since 1.0.0 | |
* | |
* @return array | |
*/ | |
function bigbox_get_theme_colors() { | |
return include get_template_directory() . '/app/customize/config/colors.php'; | |
} | |
/** | |
* Get a color. | |
* | |
* @since 1.0.0 | |
* | |
* @param string $key Color key. | |
* @return mixed String or false on no value. | |
*/ | |
function bigbox_get_theme_color( $key ) { | |
return get_theme_mod( "color-{$key}", bigbox_get_theme_default_color( $key ) ); | |
} | |
/** | |
* Get a default color. | |
* | |
* @since 1.0.0 | |
* | |
* @param string $key Color key. | |
* @return mixed String or false on no default. | |
*/ | |
function bigbox_get_theme_default_color( $key ) { | |
$colors = bigbox_get_theme_colors(); | |
if ( isset( $colors[ $key ] ) ) { | |
return $colors[ $key ]['color']; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment