Skip to content

Instantly share code, notes, and snippets.

@spencerfinnell
Created June 17, 2018 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spencerfinnell/3c026a832835203759be183afbc7d5b3 to your computer and use it in GitHub Desktop.
Save spencerfinnell/3c026a832835203759be183afbc7d5b3 to your computer and use it in GitHub Desktop.
<?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