twentyfifteen_color_scheme_css

Enqueues front-end CSS for color scheme.

Description

twentyfifteen_color_scheme_css(); 

Usage

  1. if ( !function_exists( 'twentyfifteen_color_scheme_css' ) ) { 
  2. require_once '/inc/customizer.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = twentyfifteen_color_scheme_css(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/inc/customizer.php  
  1. function twentyfifteen_color_scheme_css() { 
  2. $color_scheme_option = get_theme_mod( 'color_scheme', 'default' ); 
  3.  
  4. // Don't do anything if the default color scheme is selected. 
  5. if ( 'default' === $color_scheme_option ) { 
  6. return; 
  7.  
  8. $color_scheme = twentyfifteen_get_color_scheme(); 
  9.  
  10. // Convert main and sidebar text hex color to rgba. 
  11. $color_textcolor_rgb = twentyfifteen_hex2rgb( $color_scheme[3] ); 
  12. $color_sidebar_textcolor_rgb = twentyfifteen_hex2rgb( $color_scheme[4] ); 
  13. $colors = array( 
  14. 'background_color' => $color_scheme[0],  
  15. 'header_background_color' => $color_scheme[1],  
  16. 'box_background_color' => $color_scheme[2],  
  17. 'textcolor' => $color_scheme[3],  
  18. 'secondary_textcolor' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_textcolor_rgb ),  
  19. 'border_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_textcolor_rgb ),  
  20. 'border_focus_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_textcolor_rgb ),  
  21. 'sidebar_textcolor' => $color_scheme[4],  
  22. 'sidebar_border_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_sidebar_textcolor_rgb ),  
  23. 'sidebar_border_focus_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_sidebar_textcolor_rgb ),  
  24. 'secondary_sidebar_textcolor' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_sidebar_textcolor_rgb ),  
  25. 'meta_box_background_color' => $color_scheme[5],  
  26. ); 
  27.  
  28. $color_scheme_css = twentyfifteen_get_color_scheme_css( $colors ); 
  29.  
  30. wp_add_inline_style( 'twentyfifteen-style', $color_scheme_css );