diff --git a/includes/colors.php b/includes/colors.php index 77e1fe7..1960940 100644 --- a/includes/colors.php +++ b/includes/colors.php @@ -1,6 +1,6 @@ HTML tag. + */ +function ctfw_color_styles( $editor = false ) { + + // Get colors and proceed only if defined. + $color_palette = get_theme_support( 'editor-color-palette' ); + if ( empty( $color_palette ) ) { + return; + } + + // Gutenberg editor class. + $editor_prefix = ''; + if ( ! empty( $editor ) ) { + $editor_prefix = '.edit-post-visual-editor '; + } + + // Loop colors to build styles. + $styles = "\n\n\n"; + + // Return. + return apply_filters( 'ctfw_color_styles', $styles, $editor ); + +} + +/** + * Output frontend color styles. + * + * Must use add_theme_support( 'editor-color-palette' ) for this to work. + * + * Related: This is done by 'ctfw-editor-styles' feature for Gutenberg editor. + * + * @since 2.4.2 + * @param string $editor True if to be used in Gutenberg editor. + * @return string